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
whileleft<right: # 투 포인터인경우에는 left, right로 크기 비교로 크로스 되는 걸 막는다.
s[left], s[right] =s[right], s[left]
left+=1
right-=1
left, right=0, len(s)-1
# 투 포인터가 수학 연산 과정이 없어서 빠르다.
'''
reversed(seq)
Return a reverse iterator. seq must be an object which has a __reversed__() method or supports the sequence protocol (the __len__() method and the __getitem__() method with integer arguments starting at 0).
reverse는 값을 반환하지 않고, 단순히 해당 list를 뒤섞어준다.
-> .sort()와 같은 원리
reversed는 내장함수로, list에서 제공하는 함수가 아니다.
-> ‘reversed’ 객체를 반환한다.
-> reversed 객체를 tuple 혹은 list로 바꾸어 사용해주려면 다음과 같이 하면 된다.