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)
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)
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)