JPMorgan 2021 | Mastering HashMaps & Sliding Windows | off-campus

Question · Posted Jun 2026

Question 1: Enclosing Bottles Problem Statement There are N bottles, with respective radius values represented by ar[i]. Once a bottle is enclosed inside another bottle, it ceases to be visible. You have to minimize the number of visible bottles. The following rules are followed to place the i-th bottle inside the j-th bottle: The i-th bottle is not enclosed in any other bottle. The j-th bottle does not enclose any other bottle. ar[i] < ar[j] (Strictly smaller). Input Format First ...

The full answer & interview discussion are available to premium members.

Log in Create a free account