Problem Link:
https://online.codingblocks.com/app/player/115374/content/73646/5147/code-challenge
Code Link:
Problem Link:
https://online.codingblocks.com/app/player/115374/content/73646/5147/code-challenge
Code Link:
For this test case:
10
100008 100004 100004 100009 100000 100000 100009 100007 100004 100004
Your code is giving TLE.
Check this approach https://ide.codingblocks.com/s/257697
I think both approaches are similar, can you please point out the error and isn’t backtracking required?
Your approach is wrong and is not working correctly
Dry run with this case and check your code.
Consider a case:
4
1 2 2 1
Your output contains duplicates and also it is not in lexicographic order. Try with the recursive approach as was taught in the course.