Skip to content

Repository files navigation

Python Work

  • Programming exercises repository for algorithmic problems, done in Python 3
  • Code quality varies, there's stuff here before I knew I could auto-format code

Contents

CodeForces

Nr.TitleSolutionDifficultyTimeSpaceNotes
1285AMezo Playing ZomaPythonAO(n)O(1)
1287AAngry StudentsPythonAO(n)O(1)
1287BHypersetPythonBO(n^2 * k)O(n*k)

HackerRank

Problems related to the Python tag

Leetcode

Nr.TitleSolutionDifficultyTimeSpaceNotes
1Two SumPythonEasyO(n)O(n)
2Add Two NumbersPythonMediumO(n)O(n)
3Longest Substring Without Repeating CharactersPythonMediumO(n)O(n)
5Longest Palindromic SubstringPythonMediumO(n^2)O(n)
7Reverse IntegerPythonEasyO(log(n))O(1)
153sumPythonMediumO(n^2)O(n)
163Sum ClosestPythonMediumO(n^2)O(n)
17Letter Combinations of a Phone NumberPythonMediumO(4^n)O(4^n)
19Remove Nth Node From End of ListPythonMediumO(n)O(1)
21Merge Two Sorted ListsPythonEasyO(n)O(1)
22Generate ParenthesesPythonMediumO(4^n / sqrt(n))O(4^n / sqrt(n))
31Next PermutationPythonMediumO(n)O(1)
33Search in Rotated Sorted ArrayPythonMediumO(log(n))O(1)
43Multiply StringsPythonMediumO(n*m)O(n + m)
56Merge IntervalsPythonMediumO(n*log(n))O(n) Result array
64Minimum Path SumPythonMediumO(n*m)O(n*m)
98Validate Binary Search TreePythonMediumO(n)O(depth)
116Populating Next Right Pointers in Each NodePythonMediumO(n)O(log(depth))
124Binary Tree Maximum Path SumPythonHardO(n)O(d) where d = tree depth (worst case also n)
152Maximum Product SubarrayPythonMediumO(n)O(1)
159Longest Substring with At Most Two Distinct CharactersPythonMediumO(n)O(1)
188Best Time to Buy and Sell Stock IVPythonHardO(n*k)O(n*k)
198House RobberPythonMediumO(n)O(1)
200Number of IslandsPythonMediumO(n*m)O(n*m)
213House Robber IIPythonMediumO(n)O(1)
246Strobogrammatic NumberPythonEasyO(n)O(1)
247Strobogrammatic Number IIPythonMediumO(5^n)O(5^n)
300Longest Increasing SubsequencePythonMediumO(n*log(n))O(n)
322Coin ChangePythonMediumO(m * n)O(m)
410Split Array Largest SumPythonHardO(n^2 * m)O(n * m)
418Sentence Screen FittingPythonMediumO(~r * c )O(w)
460LFU CachePythonHardO(1) for getting and settingO(n)-ish
492License Key FormattingPythonEasyO(n)O(n)
543Diameter of Binary TreePythonEasyO(n)O(d)
547Number of ProvincesPythonMediumO(n^2)O(n)
560Subarray Sum Equals KPythonMediumO(n)O(n)
593Valid SquarePythonMediumO(1)O(1)
616 Add Bold Tag in StringPythonMediunO(w + n*m)O(w + n)
647Palindromic SubstringsPythonMediumO(n^2)O(1)
652Find Duplicate SubtreesPythonMediumO(n^2)O(n^2)
731My Calendar IIPythonMediumO(n^2)O(n)
777Swap Adjacent in LR StringPythonMediumO(n)O(n)
792Number of Matching SubsequencesPythonMediumO(n * m)O(m)
829Consecutive Numbers SumPythonHardO(N^(1/2))O(1)
833Find And Replace in StringPythonMediumO(n)O(n)
844Backspace String ComparePythonEasyO(n)O(n)
852 Peak Index in a Mountain ArrayPythonEasyO(log(n))O(1)
876Middle of the Linked ListPythonEasyO(n)O(1)
904Fruit Into BasketsPythonMediumO(n)O(1)
929Unique Email AddressesPythonEasyO(n)O(n)
935Knight DialerPythonMediumO(n)O(1)
937Reorder Data in Log FilesPythonEasyO(n*log(n))O(n)
939Minimum Area RectanglePythonMediumO(n^2)O(n)
987Vertical Order Traversal of a Binary TreePythonHardO(n * log(n))O(n)
1029Two City SchedulingPythonMediumO(n * log(n))O(n)
1041Robot Bounded In CirclePythonMediumO(n)O(1)
1074Number of Submatrices That Sum to TargetPythonHardO(n^2*m)O(n*m)
1110Delete Nodes And Return ForestPythonMediumO(n)O(n)
1136Parallel CoursesPythonMediumO(V + E)O(V + E)
1167Minimum Cost to Connect SticksPythonMediumO(n*log(n))O(n)
1396Design Underground SystemPythonMediumO(1)O(n)
1465Maximum Area of a Piece of Cake After Horizontal and Vertical CutsPythonMediumO(n*log(n))O(n)
1472Design Browser HistoryPythonMedium~O(1)O(n)
1499Max Value of EquationPythonHardO(n*log(n))O(n)
1525Number of Good Ways to Split a StringPythonMediumO(n)O(n)
1548The Most Similar Path in a GraphPythonHardO(n*m*E)O(n*m)
1648Sell Diminishing-Valued Colored BallsPythonMediumO(n* log(n))O(n)
1725Number Of Rectangles That Can Form The Largest SquarePythonEasyO(n)O(1)
1726Tuple with Same ProductPythonMediumO(n^2)O(n^2)
1727Largest Submatrix With RearrangementsPythonMediumO(nmlog(m))O(n*m)
1776Car Fleet IIPythonHardO(n)O(n)
1891Cutting RibbonsPythonMediumO(n*log(max(n)))O(1)

Links

Algorithms

Problem lists

System Design

This, but for: