Amazon Interview Report
- 0of 0 votes
AnswersGiven two Binary Trees (not BST). Each node of both trees has an integer value. Validate whether both trees have the same integers, there could be repetitive integers.
- teli.vaibhav October 02, 2015 in United States
ex-
Tree1:
5
1 6
5 4 3 6
Tree2:
1
3 4
6 5
have identical integers.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersGiven a string which may contain parenthesis. We must verify the validity of the string.
- teli.vaibhav October 02, 2015 in United States
ex-
1) "<ad675+-fkmfd>" is a valid string
2) "<[((kskfhdbh7)" is invalid
3) "[<<((shfs8))>>]" is valid
Extension to the question -
Suppose you had a hash table that told you how a parenthesis starts and how it ends as a key value pair, how would you then validate the string.
ex - <key,value> = < '(' , ')' > indicates '(' is a start parenthesis and ')' should be the end of that paranthesis.
<'A','&'> indicates that 'A' is a start parenthesis and '&' is the end parenthesis.
Note: Validity means a parenthesis that starts, must end.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm