amiedeep
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
One way could be start processing from the center of the matrix. If value x you are searching for is less than mid (center of the matrix) then move to upper-left matrix, if value x is greater than mid then move to lower-right matrix. Stop when you find the element x or element is not there.
- amiedeep November 03, 2016Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
One way could be iterate over the childs starting from father and increament a count. Once you reach n-1 count then push all those childs to a stack or somewhere. Now, you can simply list their childrens from hashmap or the input given.
- amiedeep December 21, 2016