anonymous
BAN USER- -5of 5 votes
AnswersGiven an array of positive integers, create another array of the same integer such that in the new array the integer at index i is the integer with highest frequency in the input integer.
- anonymous in United States
input array: {1,2,3,6,1,3,6,7,3,9,4,2}
output: {1,1,1,1,3,3,3,3,3,3,3}| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 2 votes
Answersfind the maximum no. of paths from (0,0) to (m,n) in a m*n matrix
- anonymous in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 2 votes
AnswersCheck if a singly linkedlist of Integer is a palindron or not.
- anonymous in India
Extraspace: O(1)| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 4of 4 votes
AnswersConsidering a stream of integers coming in. Design a datastructre to store only n of them. Insert if if does not exist in the datastructre. And if it reaches n, remove the first one inserted into the datastructure.
- anonymous in India
Datastructure should provide, addition, deletion and search all in O(1) time.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 2of 2 votes
AnswersGiven 3 Arrays of integer sorted in ascending order, get the sum of minimum difference using one element from each array.
- anonymous in India
where a, b, c are the elements from each array.
diff = |a-b| + |b-c|+|c-a|
complexitiy: worst case O(n)| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm