Пример #1
0
    def testHello(self):
        nums = [2, 7, 11, 15]
        target = 9

        expectedOutput = [0, 1]
        actualOutput = twoSum(nums, target)

        self.assertEqual(expectedOutput, actualOutput)
Пример #2
0
 def test_list_range_17(self):
     result = twoSum([
         12, 13, 14, 15, 16, 17, 18, 19, 34, 65, 23, 23, 12, 55, 12, 23, 93
     ], 46)
     self.assertEqual(result, [0, 8])
Пример #3
0
 def test_list_range_20(self):
     result = twoSum([
         0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
         19
     ], 37)
     self.assertEqual(result, [18, 19])
Пример #4
0
 def test_list_range_7(self):
     result = twoSum([2, 1, 1, 0, 7, 3, 5], 7)
     self.assertEqual(result, [0, 6])
Пример #5
0
 def test_list_range_same(self):
     result = twoSum([4, 6, 6, 6, 32, 8], 12)
     self.assertEqual(result, [0, 5])
    def test_list_range_4(self):

        result = twoSum([2,5,1,7], 8)

        self.assertEqual(result, [2,3])
    def test_list_range_20(self):

        result = twoSum([4,6,5,13,11,32,30,2,7,10,11,66,32,10,29,1,12,23,19,51], 39)

        self.assertEqual(result, [5, 8])
Пример #8
0
	def test_list_range_7(self):
		result = twoSum([2,1,1,0,7,3,5], 7)
		self.assertEqual(result, [0,6])
Пример #9
0
 def test2(self):
     nums = [1, 3, 5, 6, 15]
     target = 11
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [2, 3])
Пример #10
0
	def test_list_range_17(self):
		result = twoSum([12,13,14,15,16,17,18,19,34,65,23,23,12,55,12,23,93], 46)
		self.assertEqual(result, [0,8])
Пример #11
0
	def test_list_range_19(self):
		result = twoSum([2,5,1,7,32,12,23,12,23,56,45,6534,65,23,23,12,55,12,23], 77)
		self.assertEqual(result, [4,10])
Пример #12
0
	def test_list_range_12(self):
	    result = twoSum([3,6,2,0,23,1,64,32,12,10,19,18], 2)
	    self.assertEqual(result, [2,3])
Пример #13
0
	def test_list_range_20(self):
	    result = twoSum([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], 37)
	    self.assertEqual(result, [18,19])
Пример #14
0
	def test_list_range_15(self):
		result = twoSum([32,12,23,12,23,56,45,6534,65,23,23,12,55,12,23], 6557)
		self.assertEqual(result, [2,7])
Пример #15
0
 def test_list_range_4(self):
     result = twoSum([2, 5, 1, 7], 8)
     self.assertEqual(result, [2, 3])
Пример #16
0
 def test3(self):
     nums = [6, 12, 14, 30]
     target = 36
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [0, 3])
Пример #17
0
def test_twoSum():
    assert [1, 0] == twoSum([1, 2], 3) or [0, 1] == twoSum([1, 2], 3)
Пример #18
0
 def test5(self):
     nums = [120, 250, 460, 705]
     target = 955
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [1, 3])
    def test_list_range_15(self):

        result = twoSum([3,30,21,25,11,66,32,10,29,1,12,23,45,56,4], 34)

        self.assertEqual(result, [1, 14])
Пример #20
0
 def test6(self):
     nums = [0, 4, 3, 0]
     target = 0
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [0, 3])
    def test_list_range_12(self):

        result = twoSum([3,21,25,10,29,1,12,23,45,56,4,45], 49)

        self.assertEqual(result, [8, 10])
Пример #22
0
 def test7(self):
     nums = [1, 3, 2, 4]
     target = 6
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [2, 3])
    def test_list_range_19(self):

        result = twoSum([3,30,21,25,11,66,32,10,29,45,56,4,13,11,32,30,2], 55)

        self.assertEqual(result, [1, 3])
Пример #24
0
 def test1(self):
     nums = [2, 7, 11, 15]
     target = 9
     result = twoSum.twoSum(nums, target)
     self.assertEqual(result, [0, 1])
Пример #25
0
 def test_list_range_8(self):
     result = twoSum([3, 2, 23, 43, 12, 12, 54, 34], 77)
     self.assertEqual(result, [2, 6])
Пример #26
0
# This is a sample Python script.
import twoSum
import lengthOfLongestSubstring
import findMedianSortedArrays
import longestPalindrome
import reverseInteger
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print(twoSum.twoSum([3, 2, 4], 6))
    print(lengthOfLongestSubstring.lengthOfLongestSubstring("abcabcbb"))
    print(
        findMedianSortedArrays.findMedianSortedArrays([2, 3, 4, 5, 6],
                                                      [2, 3, 6, 7, 9]))
    #print(longestPalindrome.longestPalindrome("abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa"))
    print(reverseInteger.reverse(-383))

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Пример #27
0
 def test_list_range_15(self):
     result = twoSum(
         [32, 12, 23, 12, 23, 56, 45, 6534, 65, 23, 23, 12, 55, 12, 23],
         6557)
     self.assertEqual(result, [2, 7])
    def test_list_range_10(self):

        result = twoSum([4,6,5,13,11,32,30,2,7,10], 43)

        self.assertEqual(result, [3, 6])
Пример #29
0
 def test_list_range_12(self):
     result = twoSum([3, 6, 2, 0, 23, 1, 64, 32, 12, 10, 19, 18], 2)
     self.assertEqual(result, [2, 3])
    def test_list_range_same(self):

        result = twoSum([4,6,6,6,32,8], 12)

        self.assertEqual(result, [0, 5])
Пример #31
0
 def test_list_range_19(self):
     result = twoSum([
         2, 5, 1, 7, 32, 12, 23, 12, 23, 56, 45, 6534, 65, 23, 23, 12, 55,
         12, 23
     ], 77)
     self.assertEqual(result, [4, 10])
    def test_list_range_8(self):

        result = twoSum([4,6,5,2,15,12,33,12], 37)

        self.assertEqual(result, [0, 6])
Пример #33
0
 def test_list_range_10(self):
     result = twoSum([4, 6, 5, 13, 32, 30, 2, 7, 10], 43)
     self.assertEqual(result, [3, 5])
    def test_list_range_7(self):

        result = twoSum([4,6,5,13,11,32,30,2,7,10], 37)

        self.assertEqual(result, [2, 5])
Пример #35
0
from twoSum import twoSum 
print twoSum([0, 4, 3, 0], 0)
                    
Пример #36
0
	def test_list_range_8(self):
		result = twoSum([3,2,23,43,12,12,54,34], 77)
		self.assertEqual(result, [2,6])