Software Engineer / Developer Interview Questions
- 0of 0 votes
Answerscreate a mirror of a binary tree.
- AVK September 22, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersGiven a string of text, group all the words such that anagrams are stored and returned together in groups.
- AVK September 22, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersRemove duplicates in a string.
- AVK September 22, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - -3of 5 votes
AnswersFind out the sum of diagonals of matrix(here 2 diagonals)
- Anonymous September 22, 2013 in United States
###Any1 having Better solution?pls i really need this
WITH ALGORITHM (step by step) fr my interview.###
Constraint:
u should use the middle element only once..
matrix
1 2 3
4 5 6
7 8 9
Here 1st diagonal is 1+5+9=15
2nd diagonal is 3+shouldn't repeat(5)+7=15...| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - -1of 1 vote
AnswersGiven an array of strings. Find the common combination of the strings in the array. Given : There is one combination of the strings in the array that uses all the elements in the array.
- ur2cdanger September 19, 2013 in United States
For example : Array a = { "abc","efgh","abcde","fgh","abcd","defgh"}; ans = abcdefgh ; Because "abc"+"defgh" = "abcdefgh",
""abcd"+"efgh" = "abcdefgh"
"abcde"+"fgh" = "abcdefgh"| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a function that return a list string which permute all other letters (b to z) by keeping letter aa combination when the size of string is given.
- ary September 19, 2013 in United States
Say n = 4 Output aabb,aabc,aabd..aazz abab,abac,abad..azaz abba,abca,abda..azza baab,baac,baad..zaaz . . bbaa,bcaa,bdaa..zzaa
Say n=5 Output aabbb,aabbc...aazzz ababb,ababc...azazz . . bbbaa,bbcaa...zzzaa| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 5of 5 votes
AnswersA link list contains following elements
struct node{ int data; node* next; node* random; }
Given head of such a linked list write a function who copies such a linked list and returns the head of the new list. So if in the original list first node points to fourth node in random the copy should have the same relation. The random pointer can point to any node including itself and more than two nodes can have random pointer to the same node.
- vik September 13, 2013 in United States
Required time complexity O(n) and no extra space can be used (apart from the newly allocated memory which you will need to create the new list)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C++ Data Structures - -2of 4 votes
AnswersWrite a thread safe data structure such that there could be only one writer at a time but there could be n readers reading the data. You can consider that incrementing or decrementing a variable is an atomic operation. If more than one threads try to write simultaneously then just select one randomly and let others wait
- vik September 13, 2013 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C++ Data Structures Operating System - 3of 3 votes
AnswersGiven a bst and a group of numbers g, check whether all the elements of g occur in the same path.
- thebiker925 September 12, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersYou're given 50 cups of sugar water. Each cup has the same volume but different amount sugar in it. Each cup is labeled with the ratio. Write an algorithm that tells us if it is possible to mix together different cups and get sugar water with perfect 1:1 ratio
- RabbitDawn September 12, 2013 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Dynamic Programming - 1of 1 vote
Answersgiven two nodes of a binary tree, find number of nodes on the path between the two nodes.
- codemonkey September 11, 2013 in United States1 2 3 4 5 4, 3 -> (4-2-1-3): 4
| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer - -4of 4 votes
AnswersTwo sorted 2D arrrays, get the third one sorted
- codemonkey September 11, 2013 in United States
A = [["a", 1], ["b", 2]] sorted all elements have different names
B = [["a", 2], ["c", 3]] sorted
C = [["a", 3], ["b", 2], ["c", 3]] sorted| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer - 2of 2 votes
AnswersGiven nxn boolean matrix (0's and 1's) .
- thebiker925 September 11, 2013 in United States
Find out whether there exist a row i and column j such that
1) all elemets of row i are zero's and
2) all elements of column j are 1's and
3)(i,j)th entry of the matrix can be either 0 or 1
Find out such a i and j exist or not .
complexity :O(n)| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a 2d matrix with characters and a dictionary. Find non-distinct occurrences of the words found in the array, horizontally, vertically or diagonally, and also the reverse in each direction.
- Rinka September 11, 2013 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven below is a tree/trie
- anilkumar.bhaskara September 10, 2013 in United States
A
B c D
e F
a<b<e<>>c<>d<f<>>>
above string represents the following trie/tree (visualize) and assume that there exisits a serialize method that performs above.
Now, write a deserialize method so that above string to an object model of the following
TreeNode
TreeNode[] children| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - -2of 2 votes
Answerschar *p="hello";
- James Liu September 10, 2013 in United States
Which statement is more efficient to access p[2]? and why.
1) p[2]
2) *(p+2)
---
It should be an interesting question to think over.| Report Duplicate | Flag | PURGE
Software Engineer / Developer - 0of 0 votes
AnswersGiven a 2D array (n x m) of integers, find all duplicate rows and print their index.
- ks4394 September 10, 2013 in -| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
Answersint a,i;
- James Liu September 10, 2013 in United States
(i++)=a;
(++i)=a;
which statement is correct? --explain the reason in the view of compiler.
note: it's not related to initialization or not. say i=2, a=5. I think it is a nice question to test the interviewee's knowledge of compiler.| Report Duplicate | Flag | PURGE
Intel Software Engineer / Developer Compiler - 0of 2 votes
AnswersGiven a float number 7.64, convert it into the string WITHOUT using any inbuilt function/library.
- sandy September 05, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - -3of 5 votes
AnswersIf you have a 10G file and only 2G of memory, how can you fit the file into the memory. Describe the solution and write the code.
- curious September 03, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Problem Solving - 1of 3 votes
AnswersReverse a string without using any temporary variable.
- rasmiranjanbabu August 31, 2013 in India
Suppose {{char str[] = "Hello"; then str[] = "olleH";}}}.
I told him we can "shift H to o then o to H", similarly so on. But could able to write the code.| Report Duplicate | Flag | PURGE
HCL Software Engineer / Developer C - 0of 2 votes
AnswersSuppose a linked list (having n number of node) is given to you. You don't have the starting address. I have given you suppose address of "3rd" node.
ptr = Address of 3rd node;
Now using only ptr delete 5th node. And at the end of the program my "ptr should have the address of 3rd node". Don't use any temporary ptr and variable etc.
- rasmiranjanbabu August 31, 2013 in India| Report Duplicate | Flag | PURGE
HCL Software Engineer / Developer C# - 6of 6 votes
AnswersGiven an input array
- gowthamganguri August 30, 2013 in India
a={1,2,3,6,2,8----}
product of all numbers=p=a[0]*a[1]*---a[n-1] where n is size of array
output arrau should be b={p/a[0],p/a[1],p/a[2]-----}. you should not use division operator.Time complexity should be less than o(n2).| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - -2of 2 votes
Answershow to find the suitable maze path
- chandan795870 August 29, 2013 in India for 7| Report Duplicate | Flag | PURGE
ASU Software Engineer / Developer - 4of 4 votes
AnswersGiven a array of size n. Divide the array in to two arrays of size n/2,n/2. such that average of two arrays is equal.
- gowthamganguri August 29, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - -1of 1 vote
AnswerYou are planning a big programming conference and have received many proposals which have passed the initial screen process but you're having trouble fitting them into the time constraints of the day -- there are so many possibilities! So you write a program to do it for you.
- ruby.dhivi August 29, 2013 in India
· The conference has multiple tracks each of which has a morning and afternoon session. · Each session contains multiple talks. · Morning sessions begin at 9am and must finish by 12 noon, for lunch. · Afternoon sessions begin at 1pm and must finish in time for the networking event. · The networking event can start no earlier than 4:00 and no later than 5:00. · No talk title has numbers in it. · All talk lengths are either in minutes (not hours) or lightning (5 minutes). · Presenters will be very punctual; there needs to be no gap between sessions. Note that depending on how you choose to complete this problem, your solution may give a different ordering or combination of talks into tracks. This is acceptable; you don’t need to exactly duplicate the sample output given here.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm C++ - 0of 6 votes
AnswersHow does a search engine perform exact phrase search? i.e. search for the term "the bees knees" exactly.
- sarasaurus August 24, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Distributed Computing - 5of 5 votes
AnswersWe have a day to work and we have different kinds works do to which has start-time and end-time. We have to choose the different works so that we can achieve the maximum number of minutes in a day to work. Chosen works should not overlaps to each other.
- Rahul August 22, 2013 in India
Ex-1:
Start-Time End-Time
W1: 6:00 9:30
W2: 9:00 12:30
W3: 12:00 14:30
W4: 10:00 10:30
W5: 11:00 13:30
Solution: W1 + W4 + W3(or W5)
Ex-2:
Start-Time End-Time
W1: 6:00 8:30
W2: 9:00 11:00
W3: 12:30 14:00
W4: 8:00 9:00
W5: 10:30 14:00
W6: 9:00 11:30
Solution : W1 + W6 + W3 = 390min| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersThere are few sets with some numbers. And you are given an array of numbers. Find combination of sets with minimum number of sets, union of which have all these numbers.
- aks August 22, 2013 in India
Example:
input sets:
A => [1,2,3]
B => [2,5,8]
C => [1,4,5]
D => [3,5,8]
Array to find:
{3,4,8}
Answer:
C + D| Report Duplicate | Flag | PURGE
InMobi Software Engineer / Developer Algorithm - 0of 0 votes
AnswersThe question: given a binary tree, print all paths that sum to a certain value.
I've come up with the following approach (C++). This is different from other solutions I found on the web, that search the path list every time. I would appreciate your opinion regarding my attempt.
- ks4394 August 19, 2013 in United States// Main function void print_path_with_sum(Node* root, int expected_sum) { if (!root) return; std::vector<Node*> path; search_to_bottom(root, path, 0, expected_sum); print_path_with_sum(root->left, expected_sum); print_path_with_sum(root->right, expected_sum); } // Helper function void search_to_bottom(Node* node, std::vector<Node*>& path, int current, int expected_sum) { if (!node) return; current += node->value; path.push_back(node); if (current == expected_sum) { print_path(path, 0, path.size()); } search_to_bottom(node->left, path, current, expected_sum); search_to_bottom(node->right, path, current, expected_sum); path.pop_back(); }
| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm