what is the problem with this approach…
why is answer coming wrong
PAIR OF ROSES QUESTION DOUBT: https://ide.codingblocks.com/s/182729
Mistake 1: it does not check all the pairs.
Mistake 2: consider
6
10 20 30 40 50 60
80
your code prints 40 40 because it checks for (i<=j) which is wrong, the question can be solved using maps