コード例 #1
0
def test(head_list, n, ans_list):

    head = ListNode.fromList(head_list)
    ans = ListNode.fromList(ans_list)

    s = Solution()
    r = s.removeNthFromEnd(head, n)
    if r != ans:
        print('not correct', head_list, n, r, ans)
コード例 #2
0
ファイル: main.py プロジェクト: hasadent/leetcode
def test(head_list, k, ans_list):

    head = ListNode.fromList(head_list)
    ans = ListNode.fromList(ans_list)

    s = Solution()
    r = s.reverseKGroup(head, k)
    if r != ans:
        print('not correct', head_list, k, r, ans)
コード例 #3
0
def test(head_list, ans_list):

    head = ListNode.fromList(head_list)
    ans = ListNode.fromList(ans_list)

    s = Solution()
    r = s.swapPairs(head)
    if r != ans:
        print('not correct', head_list, r, ans)