Can I add new functions like swap(), quicksort() etc?


If so how? Should it be Solution::swap()? I am getting runtime errors though my code works.


There must be some other issue with your code bcz it works perfectly fine in my case.
I simply used “swap(add1,add2);” (this way, nothing else)

and you may want to use qsort() in C and sort() in C++

also check carefully if you are not accessing something out of assigned memory (just in case some silly mistake :wink: )