Problem Statement:

You have a certain amount of cash available, consisting of bills of denominations 100, 200, and 500. You also have a list of ATMs, each with a pre-specified amount of cash it should have after loading. Your task is to design an algorithm to distribute the available cash across these ATMs in such a way that:

1. Each ATM receives enough cash to meet its pre-specified amount.
2. All cash is distributed, leaving no cash behind.
3. The smaller denominations are split into each ATMs instead of loading in particular ATMs.

Given Input:

Initial Cash – A dictionary where keys are denominations (100, 200, 500) and values are the count of each denomination.
initial_cash = (100: 3600, 200: 500, 500: 1000)

ATM List- A list of dictionaries where each dictionary represents an ATM with its ID and the pre-specified amount it needs.

The above problem statement is already resolved.

Now we want to extend the use case. We would you sending an optional json input, which contains minimum required denomination of 100s and 200s for each ATM, In addition to the initial cash if pre-specified amount for each ATM can be satisfied using both initial cash and  minimum required denomination input, then the output will be very much optimistic. If unable to satisfy the minimum required denomination based on initial cash input, then no worries then the program should return the output as it is now.

Posted On: August 16, 2024 05:13 UTC
Category: Scripting & Automation
Skills:Python, Python Script

Country: India

click to apply

Powered by WPeMatico