Amazon Interview Report
- 0of 0 votes
Answersgiven an array of integers S[], visualize it as a bar graph, with the index i as x coordinate and the S[i] as the y coordinate. and that the bars are shaded. find the largest rectangle, in the shaded bars.
- Apritha May 25, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
Answersgiven two arrays A and B.
- Apritha May 25, 2011
A has integers unsorted.
B has the same length as A and its values are in the set {-1,0,1}
you have to return an array C with the following processing on A.
if B[i] has 0 then C[i] must have A[i]
if B[i] has -1 then A[i] must be in C within the sub array C[0] - C[i-1] ie. left subarray
if B[i] has 1 then A[i] must be in C within the sub array C[i+1] - C[length(A)] ie right subarray.
if no such solution exists then printf("no solution");| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.