목차


두 수가 교차하는 경우의 수를 다루는 방법

def semiOrderedPermutation(self, A: List[int]) -> int:
    n = len(A)
    i, j = A.index(1), A.index(n)
    return i + n - 1 - j - (i > j)

2024-05-05
다음 글: Introduction to Shortest Path algorithm → 카테고리로 돌아가기 ↩