I like this idea, thanks!
@suilan0602 brilliant idea.
@KUSHAL18 Appreciate it. Thanks!
I agreeedg;lkhbporthbjrtj ioien m mlmvlvkeu456859idjkbtASDOLP;'#
No one has replied
@StefanPochmann Ah, I see. Yea, I agree with you at this point.
Your algorithm has a worst case time complexity of O(n^2), when no swap is done.
I have a similar approach with O(n) worst case time complexity, as in the following:
@bacon I agree, but between time and space, I would be ready to compromise more space than time. :)
My C# solution. Same idea except I just use int.Parse to convert string back to int.
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.