Basically we have to check only till the sum of largest and second largest element and we are good to go.
so if problem has coins {1,3,6,10,15} check till 25 only . and then if greedy works just apply it and save your time and space constraint!!!
It was so exciting for me to learn that is why i wrote it here








