Hello. Please help me in this problem : Monk and Modulo Based Sorting
My code : https://pastebin.com/5p0ZzZ0g
Expected Output :
12 18 46 17 65
My Code’s Output :
12 18 17 65 46
Please help me find out where there is an error in my code. @vijju1231 @ssjgz
Thank You.
Your method won’t sort it correctly. Instead create a tuple <seq[i]%k,initial index, seq[i]>
Use the inbuilt sort and output the third number in the sorted array
Your sort won’t work for something like 2 6 10 1
Your sort will just switch 10 and 1 and consider it sorted.
1 Like