SE Engineer
BAN USER
Comments (3)
Followers (1)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
To avoid division operation we can skip specific output[i] element in the multiple operation calculation.
So assuming output[i] = X2 means that total result will be equal to
X1 * x2 * x3 *x4 *x5 / x2 = X1 * X3 * X4 * X5.
Comment hidden because of low score. Click to expand.
0
of 2 vote
- Define boolean array busyHours with false values from startHour until endHour
- Iterate person1 and person2 times and set appropriate flags in the boolean array to true
- Go through resulted busyHours array and find flags with false value. It's free time
Page:
1
Repstacimdalton, Dev Lead at ASAPInfosystemsPvtLtd
At the moment I'm implementing Slinkies in the financial sector. My current pet project is researching break up a ...
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
We can use the fact that array[duplicateValue] is referenced to the same value when we traverse array. So if we mark array[duplicateValue] in the array as traversed in first time and figure out it in the next time then it's duplicate value. To mark value as traversed we can change it to negative one. O(n) algorithm without extra space
Limitations of input data: positive numbers and less than length of array
- SE Engineer April 02, 2015