Menu
Question Index
...

Write a program to get the minimum set of currency notes required to return any amount till the highest amount. So, just using the currency notes from the returned list, we should be able to return any amount till the highest amount. If the highest amount is 20, we should be able to return 5 or 7 or 17 or 20, just using those notes.

Input (Integer) Output (List)
1 [1]
5 [1, 2, 2]
79 [1, 2, 4, 8, 16, 32, 16]
121 [1, 2, 4, 8, 16, 32, 58]
999 [1, 2, 4, 8, 16, 32, 64, 128, 256, 488]
4516 [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 421]
0 null


import java.util.*;
class GetRequiredCurrencyNotes
{
    public static void main(String s[])
    {
        List<Integer> output = getCurrencyNotesSet(20);
        System.out.println("The minimum set of notes required are : " + output);

    }


    public static List<Integer> getCurrencyNotesSet(int highestAmount) {
    }

}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App