Ejemplo n.º 1
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'twoSum')
    driver.run(
        nums=[2, 7, 11, 15],
        target=9,
    )
Ejemplo n.º 2
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'minPathSum')
    driver.run(grid=[
        [1, 3, 1],
        [1, 5, 1],
        [4, 2, 1],
    ])
Ejemplo n.º 3
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'multiply')

    numbers = [
        ("3", "5"),
        ("123", "456"), ]

    for num1, num2 in numbers:
        driver.run(num1=num1, num2=num2)
Ejemplo n.º 4
0
def main():

    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'addTwoNumbers')

    l1 = createList(values=[2, 4, 3])
    l2 = createList(values=[5, 6, 4])

    driver.run(
        l1=l1,
        l2=l2, )
Ejemplo n.º 5
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'longestPalindrome')

    strings = [
        "babad",
        "cbbd",
    ]

    for s in strings:
        print("\n\nRunning..")
        driver.run(s=s)
Ejemplo n.º 6
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'longestSubstring')

    strings = [
        "abcabcbb",
        "bbbbb",
        "pwwkew",
    ]

    for s in strings:
        print("\n\nRunning..")
        driver.run(s=s)
Ejemplo n.º 7
0
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'zigzag')

    args = [
        ("PAYPALISHIRING", 3),
        ("PAYPALISHIRING", 4),
    ]

    for s, numRows in args:
        print("\n\nRunning...")
        driver.run(
            s=s,
            numRows=numRows,
        )
Ejemplo n.º 8
0
def main():

    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'medianSortedArrays')

    args = [
        ([1, 3], [2]),
        ([1, 2], [3, 4]),
    ]

    for nums1, nums2 in args:
        driver.run(
            nums1=nums1,
            nums2=nums2,
        )
def main():
    from practice.util import DriverFactory
    Driver = DriverFactory('basic')
    driver = Driver(Solution, 'maxArea')

    driver.run(height=[1, 8, 6, 2, 5, 4, 8, 3, 7])