Ericsson India Hiring Challenge | Design an ATM Machine | On-Campus OA (2022)

Question · Posted Jun 2026

Problem Statement Design an ATM machine that supports five denominations: 20 50 100 200 500 Implement the following operations: deposit(int[] banknotesCount) – Deposits the specified number of banknotes. withdraw(int amount) – Withdraws the exact amount using the minimum number of notes (largest denominations first). If withdrawal is impossible, return [-1]. Example Input ATM() deposit([0,0,1,2,1]) withdraw(600) Output [0,0,1,0,1] Test Cases Test Case 1 Input deposit([0,0,0,0,1]) withdraw(200) Output [-1] Test Case 2 Input deposit([1,1,1,1,1]) withdraw(150) Output [0,1,1,0,0]

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

Log in Create a free account