I built this repo to keep practicing coding problems and logic. Please share your thoughts on better solutions for any problem ✨
When given a string, finds longest substring without repeating characters
>>> longest_nonrepetitive_substring('tzmfrlssjydyysdxiidw')
tzmfrls 7
When given a string, s, find the longest palindromic substring in s
>>> longest_palindrome('kayaking')
kayak
When given a string containing brackets, check if the the input string is valid or not by checking if the opening and closing brackets are balanced
>>> isValid('()[{}]')
True
>>> isValid('([)]')
False
🎯 two sum
When given a list of numbers, and a target number k, check if there are two numbers in the list that add up to k
>>> two_sum([1, 3, 5, -2], 8)
True
>>> two_sum([-2, -4, 6, 2], 5)
False
When given a list of numbers, find if there exists a pythagorean triple in that list.
>>> py([3, 5, 12, 4, 14])
True
# 3, 4, 5
>>> py([6, 2, 12, 7, 14])
False