You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we have to keep the space complexity constant and we know that numbers will always be 0,1 or 2 so we just found their frequency and append accordingly.
Time Complexity = O(n) , Space = O(1)
"""
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.