--
BAN USER- 0 Answers "Microsoft SDET" or "FlipKart SDE II"
Hi Guys,
- -- May 04, 2012
I have 3 yrs of strong development experience with Product Based Startup.
Now, I have got one offer from Microsoft for the SDET role, and another one from FlipKart for the SDE II role.
Any suggestions as in what opprtunity shall I opt for a better career in long term?| Flag | PURGE
This solution seems convincing when the ropes burn with a uniform rate.
This ain't correct for the given scenario.
Consider a case where it take 30min to to burn 25% of the rope and another 30min for the rest 75% [given the rate could be non-uniform]. In that case, 30min would have passed when only half the rope is burnt if burnt from both ends.
This problem can be modified as:
1) Monkey can only walk right or up, one step at a time.
2) For the origin(0,0), count it only once.
3) For all the points on x-axis or y-axis, count them twice.
4) For all other points, count them 4 times.
int arr[1024][1024] = {0};
void AccessibleCoordinates(int x, int y, int &count)
{
if(arr[x][y] == 1) return; //already traversed
else arr[x][y] = 1;
if(SumOfDigits(x)+SumOfDigits(y) > 19) {return;}
if(x==0 && y==0) {count += 1;}
else if(x==0 || y==0) {count += 2;}
else {count += 4;}
AccessibleCoordinates(x+1, y, count);
AccessibleCoordinates(x, y+1, count);
}
It can be done in 2 measures:
Divide the 8 balls in 3 sets of 3,3,2.
Measure1: Weigh Set1 against Set2 => From here you can determine whether the heavier one belongs to Set1 or Set2 or Set3(if weights are equal).
Measure2: If you are left with Set3, measure the two balls against each other. Else if you are left with Set1/Set2, weigh two of the balls from that set against each other and you can determine whether one of them is heavier or the 3rd is actually heavier.
There could be thousand reasons...as some are already stated..
Few common problems could be that the application is relying on the current invokation: using system time, using process or parent process id etc, uninitialized memory with some garbage values, race conditions, etc and many many more...
# Use a singly linked list to represent the queue that would hold the items according to their priorities.
# Since we have constant number of priorites (say 1 to 10), we can have an array of structure(of the type mentioned below) that would give us the hint where to insert an item in the linked list.
struct sub_pq {
Node* first;
Node* last;
};
Enque: Look in the array for 'last' node for the given priority, and insert next to it. If there is no item with this priority already in the list, then look for 'last' of higher priorities and/or 'first' of lower priotities, and then insert the item at it's appropriate position.
Then update the corresponding array element accordingly. O(1)
Deque: Remove first item from the linked list, and update the corresponding array element accordingly. O(1)
Nice algo, but needs little modification:
int Palindrome(node *p, bool bInternalCall = false)
{
static node *head;
static int result;
if(!bInternalCall)
{
head = p;
result = 2;
}
if(p){
result=Palindrome(p->next, true);
if(result==0||result==1) return result;
if(head->data==p->data){
if(head==p||head->next==p) return 1;
head=head->next;
}else return 0;
}
return result;
}
#Create a TRIE tree, with a special node at the end of each WORD.
#Read the words one by one until EOF.
#Whenever a new word is added in the TRIE, write 1 in it's special terminal node and increment unique_count.
#Whenever a word is repeated, increment the counter in it's terminal node. If the counter is incremented from 1 to 2, also decrement the unique_counter.
I assume that Sorted Matrix means sorted across each row and each column, instead of sorted as per BFS.
For that case, this will not work. Try to find 4 in the following matrix:
1 2 3 4
2 5 6 7
3 6 7 8
5 7 8 9
Correct Solution:
#Start from Top-Right position.
#If it's value is greater than the search_value, move down and discard the current row.
#If it's value is lesser than search_value, move left and discard the current column.
#Else, you have found your search_value.
#Repeat until you find the search_value or reach the bottom-left.
Maximum moves: N towards left + N towards down.
So Complexity: O(N).
To be clear, it doesn't indicate anything as all the three varables are in the same stack frame.
For e.g, if you have "int arr[10]", then &arr[1] will always be greater than &arr[0].
You do have to make a function call for new stack frame to be created, as suggested by 'Topcoder'.
Start with the first element. As long as the current element is same as the next element, step ahead two places. When they are different or when only one is left, current one is the first unpaired element.
- -- March 29, 2012