Andi
- 12
0of 0 votes
AnswersDesign algo for insertElement, deleteElement and getRandomElement, expected complexity for all the operations will be less than O(n).
- Andi on December 12, 2012 in United States Edit | Report Duplicate | Flag
Microsoft Algorithm - 15
0of 0 votes
AnswersI have one bag of bolts and another bag of nuts, need to find biggest Bolt. Condition is must not compare both bolts or both nuts. only comparison between bolt and nut allowed.
- Andi on December 12, 2012 in United States Edit | Report Duplicate | Flag
Microsoft Algorithm - 40
0of 0 votes
Answersgenerate permutations of a string without duplicates and without using hashtable to memorize the permutations.
- Andi on December 05, 2012 in United States Edit | Report Duplicate | Flag
Amazon Software Engineer / Developer Algorithm - 26
0of 0 votes
Answerswrite insert method to insert a node into sorted circular linked list (Sorted based on int value). insert method takes 2 arguments, one is value to be inserted and other is reff to any random node in the sorted circular linked list
- Andi on December 04, 2012 in United States Edit | Report Duplicate | Flag
Amazon Software Engineer / Developer Algorithm - 12
0of 0 votes
Answersfind longest palindrome in a given string, expecting time complexity must be less than O(n^2).
- Andi on November 25, 2012 in United States Edit | Report Duplicate | Flag
Amazon - 14
0of 0 votes
Answerswrite a function to check given string matches with given pattern
- Andi on November 24, 2012 in India Edit | Report Duplicate | Flag
Condition: only one wildcard used in the pattern, that is '*', but can be used in the pattern more than once.
Example:
pattern: *abc*def*.doc*
str: adsfabcxyzdefgh.docx
fucntion signature is like: boolean isMatching(String str, String pattern);
Microsoft - 0
0of 0 votes
AnswersWrite a method to which will download a file from remote server
- Andi on November 23, 2012 in India Edit | Report Duplicate | Flag
conditions are: if remote server not responding then should go into resume. Once it up it should start download file from where it got resumed.
Adobe Computer Scientist - 5
0of 0 votes
Answerswrite two separate methods,
- Andi on November 23, 2012 in United States Edit | Report Duplicate | Flag
1. read method to read file and
2. write method to write to file,,,
both must be thread safe and throughput (efficiency) should be high.
Adobe Computer Scientist Application / UI Design - 7
0of 0 votes
AnswersHow can I give new implementation to methods in String.
- Andi on November 22, 2012 in India Edit | Report Duplicate | Flag
For example: I need to give new implementation to concat method, which concats two string and convert to uppercase.
I answered that, i create new custom class and create a method concat and implement it as the way interviewer want, but he asked that he want to do for all the methods in String, so writing new implementation for a methods is not a feasible solution.
Goldman Sachs Applications Developer - 1
0of 0 votes
Answerclass A {
- Andi on November 16, 2012 in India Edit | Report Duplicate | Flag
public void method1();
public void method2();
public void method99();
public void method100();
}
Another factory class returning object of class A, how to implement logging mechanism, which should log entry and exit of each method call in class A.
BT Software Engineer / Developer Application / UI Design - 3
0of 0 votes
AnswersHow many squares are in chess board?
- Andi on November 15, 2012 in India Edit | Report Duplicate | Flag
BT Software Engineer / Developer - 1
0of 0 votes
AnswerGive an example for factory pattern (not abstract factory) with code
- Andi on November 15, 2012 in India Edit | Report Duplicate | Flag
BT Software Engineer / Developer Application / UI Design - 5
0of 0 votes
Answerswrite a merge function to merge two BST's (both bst's having unique elements)
- Andi on November 15, 2012 in India Edit | Report Duplicate | Flag
BT Software Engineer / Developer Algorithm - 15
0of 0 votes
AnswersGiven unsorted array (contains -ve numbers also), write a method to return max sum. Condition is two numbers should not adjacent to each other.
- Andi on November 10, 2012 in India Edit | Report Duplicate | Flag
iLabs Software Engineer / Developer Algorithm - 3
0of 0 votes
Answerswrite a insert method for singly linked list, so that it will insert elements in the ascending order.
- Andi on November 10, 2012 in India Edit | Report Duplicate | Flag
iLabs Software Engineer / Developer Algorithm - 0
0of 0 votes
AnswersGiven n length path (assume array with 0's and 1's), each step either a rock or acid bucket (0 is acid and 1 is rock), need to find the jumping pattern of the from to cross the given path. Conditions are:
- Andi on November 10, 2012 in India Edit | Report Duplicate | Flag
lets consider, curretly frog jumping at speed s, at each step
it can maintain same speed (s)
or increase by one step (s=s+1) or
decrease by one step (s=s-1);
find the jumping sequence for the given input.
iLabs Software Engineer / Developer Algorithm - 14
0of 0 votes
Answersfind ginen BT is BST or not?
- Andi on November 08, 2012 in India Edit | Report Duplicate | Flag
Directi Algorithm - 18
0of 0 votes
AnswersAn array of n length, filled with 0's,1's and 2's, how to sort effectively?
- Andi on November 08, 2012 in India Edit | Report Duplicate | Flag
Input:{0,1,2,2,1,1,0,2,1,0}
Output: {0,0,0,1,1,1,1,2,2,2}
Directi Algorithm
private static int findMissing(int[]arr, int s, int e){
if((e-s)==1) return ((arr[s]+1)!=arr[s+1])?(arr[s]+1):-1;
int m = (s+e)/2;
int expVal = arr[s]+(m-s);
if(expVal<arr[m])
return findMissing(arr,0,m);
else
return findMissing(arr, m, e);
}
public static int findMissing(int[] arr){
if(arr.length==0) return -1;
if(arr.length==1) return arr[0]+1;
return findMissing(arr, 0, arr.length-1);
}
I guess it will fail, because
- Andi on December 17, 2012 Edit | Flag View Replyinput: {2,5,3,4,6,1}
output:
2->5
5->6
3->4
4->6
How 6 can be right child for both 5 and 4?