sol: https://ide.codingblocks.com/s/418550
prob:https://hack.codingblocks.com/app/contests/2022/1337/problem
how do I pass array by reference so that the changes from the function are reflected in the array present in main function.
sol: https://ide.codingblocks.com/s/418550
prob:https://hack.codingblocks.com/app/contests/2022/1337/problem
how do I pass array by reference so that the changes from the function are reflected in the array present in main function.
arrays are always pass by reference
mistakes
your Modified Code
but this will give TLE in one case
because sorting algorithm is not optimised
either use inbuilt sort function or use merge sort or quick sort
Correct code