Answer: Ericsson India Hiring Challenge | Design an ATM Machine | On-Campus OA (2022)
Answer · Posted Jun 2026
Approach Maintain the count of available banknotes for each denomination. During withdrawal: Start from the largest denomination. Use as many notes as possible without exceeding the available count. If the exact amount cannot be formed, return [-1]. Otherwise, deduct the used notes from storage. Strategy Store the count of each denomination. During deposit, update the counts. During withdrawal: Iterate from ₹500 to ₹20. Greedily use the largest denomination possible. If the remaining amount becomes zero, update the ATM. Otherwise return ...
The full answer & interview discussion are available to premium members.
Log in Create a free account