예제 #1
0
 def test_2(self):
     self.assertEqual(Solution().twoSum([3,5,-4,8,11,1,-1,6,1,5,-9,-4,-6.6,8],19), [8, 11])
예제 #2
0
 def test_5(self):
     self.assertEqual(Solution().twoSumDict([3,5,-4,8,11,1,-1,6],10), [11,-1])
예제 #3
0
 def test_1(self):
     self.assertEqual(Solution().twoSum([3,5,-4,8,11,1,-1,6],10), [-1, 11])
예제 #4
0
 def test_3(self):
     self.assertEqual(Solution().twoSumBrute([3,5,-4,8,11,1,-1,6],10), [11, -1])
예제 #5
0
from TwoSum import Solution
import pytest

SOL = Solution()


@pytest.mark.parametrize("nums, target, ans", [
    ([2, 7, 11, 15], 9, [0, 1]),
    ([4, 6, 2, 1], 8, [1, 2]),
])
def test(nums, target, ans):
    assert SOL.twoSum(nums, target) == ans
예제 #6
0
from TwoSum import Solution

solution = Solution()

# nums = [2,7,11,15, 3,3]
# target = 6
# result = solution.twoSum(nums, target)

# s = "dvdf"
# result = solution.lengthOfLongestSubstring(s)

# val = 1534236469
# result = solution.reverse(val)

# val = 10
# result = solution.isPalindrome(val)

# s = "PAYPALISHIRING"
# numRows = 4
# result = solution.convert(s, numRows)

#
# n = 5
# result = solution.countAndSay(n)

# s = "()[]{}"
# result = solution.isValid(s)

# strs = ["a","cc"]
# result = solution.longestCommonPrefix(strs)
예제 #7
0
def test_b():
    soln = Solution()
    assert soln.twoSum([1, 2, 3, 4, 5], 8) == [2, 4]
예제 #8
0
def test_a():
    soln = Solution()
    assert soln.twoSum([2, 7, 11, 15], 9) == [0, 1]