Ejemplo n.º 1
0
def solution() -> Solution:
    return Solution()
Ejemplo n.º 2
0
def test_is_symmetric(input_value: List[int], expected_result: List[int],
                      solution: Solution) -> None:
    original = create_list_node(input_value)
    assert convert_node_list_to_list(
        solution.reverseList(original)) == expected_result
Ejemplo n.º 3
0
def test_is_valid(input_value: List[int], expected_result: int, solution: Solution) -> None:
    assert solution.rob(input_value) == expected_result
Ejemplo n.º 4
0
def test_is_symmetric(input_value: List[Optional[int]], expected_result: bool,
                      solution: Solution) -> None:
    tree = create_tree(input_value)
    assert solution.isSymmetric(tree) is expected_result
Ejemplo n.º 5
0
def test_is_symmetric(input_value: List[int], expected_result: int, solution: Solution) -> None:
    assert solution.maxProfit(input_value) == expected_result
Ejemplo n.º 6
0
 def test_basic(self):
     s = Solution()
     self.assertEqual(3, s.romanToInt("III"))
Ejemplo n.º 7
0
 def test_lviii(self):
     s = Solution()
     self.assertEqual(58, s.romanToInt("LVIII"))
Ejemplo n.º 8
0
 def test_iv(self):
     s = Solution()
     self.assertEqual(4, s.romanToInt("IV"))
Ejemplo n.º 9
0
def test_merge_trees(input_value: Tuple[List[Optional[int]]],
                     expected_result: List[Optional[int]],
                     solution: Solution) -> None:
    t1, t2 = (create_tree(val) for val in input_value)
    assert repr(solution.mergeTrees(t1,
                                    t2)) == repr(create_tree(expected_result))
Ejemplo n.º 10
0
def test_max_depth(input_value: List[Optional[int]], expected_result: int,
                   solution: Solution) -> None:
    tree = create_tree(input_value)
    assert solution.maxDepth(tree) == expected_result