Amazon Interview Question for Java Developers
- 0of 0 votes
You are required to collect N numbers from a bag. Initially, the bag is empty. Whenever you put a number X in the bag, then the owner of the bag asks the question.- Sameer June 21, 2019 in United States
The questions are as follows:
. What is the greatest integer that is smaller than X and present inside the bag?
. What is the smallest number that is greater than X and present inside the bag?
If you answer both the questions correctly, then you can put X inside the bag. Your task is to answers the questions that are asked by the owner of the bag. If no such numbers exist in the bag print -1.
5 (Number of elements in the bag)
| Report Duplicate | Flag | PURGE
Amazon Java Developer Data Structures
Interview Type: Phone Interview
Open Chat in New Window