コード例 #1
0
 def do(self, func):
     '''todo'''
     lns = (
         ( [2, 4, 3], [5, 6, 4], [7, 0, 8]),
         ( [0], [0], [0]),
         ( [1, 8], [0], [1, 8]),
         ( [5], [5], [0, 1]),
     )
     for l1, l2, l3 in lns:
         l = func(utils.array2listnode(l1), utils.array2listnode(l2))
         self.assertEqual(utils.listnode2array(l), l3)
コード例 #2
0
 def runAlgorithm(lists: List[int]):
     return listnode2array(s.swapPairs(array2listnode(lists)))
コード例 #3
0
ファイル: solution-linear.py プロジェクト: Prev/leetcode
 def runAlgorithm(l1, l2):
     # Convert list to a linked list before passing the params.
     # After calling the solution function, re-convert the linked node value to a list value.
     return listnode2array(
         s.addTwoNumbers(array2listnode(l1), array2listnode(l2)))
コード例 #4
0
ファイル: solution-linear.py プロジェクト: Prev/leetcode
 def runAlgorithm(lists: List[int], k: int):
     return listnode2array(s.reverseKGroup(array2listnode(lists), k))
コード例 #5
0
 def runAlgorithm(l1, l2):
     return listnode2array(s.mergeTwoLists(array2listnode(l1), array2listnode(l2)))
コード例 #6
0
 def runAlgorithm(array, n):
     # Convert list to a linked list before passing the params.
     # After calling the solution function, re-convert the linked node value to a list value.
     return listnode2array(s.removeNthFromEnd(array2listnode(array), n))
コード例 #7
0
 def runAlgorithm(lists: List[List[int]]):
     return listnode2array(s.mergeKLists([array2listnode(l)
                                          for l in lists]))