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.
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.
Ok, will see. . BTW, what TC’s is it failing? All, some , ones with large data?
Here-
Input
5 1 3 5 2 14 1 7 2 3 10 4
Your Output
21
Expected Output
19
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.
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.