Pleeeeease tell me what is wrong in this solution



Problem link- Bookshelves

The link to my solution- greedy strategy

Please tell me a counter case which would fail in my solution. Thanks a lot.



5 1 3 5 2 14 1 7 2 3 10 4
Your Output
Expected Output

We can get a lower output easily. Exchange 14 in upper shelf with 2 in lower shelf. Now upper shelf has elementts 3,5,2,2,1 - max =5. Skew =19.


Ok, will see. :smiley: . BTW, what TC’s is it failing? All, some , ones with large data?


Thanks a lot. I am soooo stupid. I should leave CP.


How did I miss such an obvious case??


Dude, you need to chill. Just thinking too much, on and on and on. Focus on one thing at a time and get it sorted.


Thanks @vijju123