I passed testcases(Sample) (Problem: Reversort)

Test 1 is failing for this problem, Can you help me find it ? As I learnt that codejam qualification round we can discuss, but to keep it clean, can anyone dm me and we can discuss in private chat here. I just need help to know, whether I am on the right path. Thanks in advance :slight_smile:

https://codeshare.io/5QKZMx

5
7 19
Case #1: 2 5 4 3 6 7 1
7 25
Case #2: 2 4 6 5 7 3 1
8 30
Case #3: 2 4 6 5 7 8 3 1
8 23
Case #4: 2 6 5 4 3 7 8 1
5 25
Case #5: IMPOSSIBLE