array

The most asked coding interview - #5

Transform array such that each element contains the greatest element on its right side Problem statement In this article we will be discussing how to solve an easy problem that has been asked at Amazon coding interviews. This is a must do problem for your coding interview preparation. The problem statement goes as follows: You are given an array A of size N. You have to modify A in place s.t. A[i] = M where M is the maximum value among all elements A[j], j > i. If such element does not exists set A[i] = -1. Example Solution Since this is a quite easy… Read More »The most asked coding interview - #5