- You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) ). Write a routine in C for the above.
- Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.
- Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all
- Give a one-line C expression to test whether a number is a power of 2
- Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
- Give a very good method to count the number of ones in a "n" (e.g. 32) bit number
- Reverse a linked list.
- Insert in a sorted list
- Write a function to find the depth of a binary tree.
- Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Technical & HR Interview Questions of Google,Microsoft,Yahoo and many more Companies.
Microsoft Job Inteview questions on Algorithms and Programming
Subscribe to:
Post Comments (Atom)
Q NO : 6
ReplyDeletewhile(n)
{
if(n&1)
count+=1;
n<<1;
}
printf("%d",count);
Q NO : 4
ReplyDeleteif x is the given number
(!(x&(x-1))?printf("YES"): printf("NO");