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
앞자리부터 순서대로 체크하지 않고, 뒷자리부터 앞으로 체크하며 최소값과의 비교만으로 최소값을 갱신
뇌물을 줄 수 있는 횟수는 최대 2번으로 한정
현자리까지의 최소값과 두번째로 작은 값을 저장
이 부분에서 파이썬을 사용할 때 주의해야할 점이 있다. 간단히 리스트의 stride를 음수로 지정(q[::-1])하여 역순으로 탐색하는 것이 가능하다. 하지만 이것은 데이터의 shallow copy를 생성하기 때문에 메모리의 낭비가 발생한다. 따라서 shallow copy를 생성하지 않는 reversed() 함수를 이용하는 것을 추천한다.