Construct smallest number from I/D pattern
Company: Airbnb
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's ability to reason about permutation constraints, sequence ordering, and combinatorial construction under digit-uniqueness and numeric-minimization requirements.
Part 1: Bank Ledger Processor
Constraints
- 0 <= number of accounts <= 10^4
- 0 <= len(operations) <= 10^5
- All balances and amounts are integers
- Valid amounts must be > 0
Examples
Input: ({'A': 100, 'B': 50}, [('deposit', 'A', 20), ('withdraw', 'B', 10), ('transaction', 'A', 'B', 30), ('balance', 'A'), ('balance', 'B')])
Expected Output: [120, 40, (90, 70), 90, 70]
Explanation: Processes all four operation types successfully.
Input: ({'A': 10}, [('withdraw', 'A', 15), ('deposit', 'C', 5), ('transaction', 'A', 'A', 1), ('balance', 'C')])