Skip to content
python hub, python-hub.com, pythonhub
  • Home
  • Basics
  • Intermediate
  • OOP
  • Advanced
  • Projects
  • Quizes
  • CTk GUI
  • About Us
  • Toggle website search
Press Escape to close the search panel.
Menu Close
  • Home
  • Basics
  • Intermediate
  • OOP
  • Advanced
  • Projects
  • Quizes
  • CTk GUI
  • About Us
  • Toggle website search

Author: Maitry

This author has written 301 articles
Uncategorized

42. Trapping Rain Water – Solution [Brute-Force to Best]

Here’s the question link on LeetCode 42. Trapping Rain Water: https://leetcode.com/problems/trapping-rain-water/description Brute Force O(n²)Better O(n)Another Approach: Monotonic Stack O(n)Optimal O(n) Brute Force O(n²) For every index, I need to figure…

0 Comments
November 13, 2026
Uncategorized

189. Rotate Array – Solution [Brute-Force to Best]

Here’s the question link on LeetCode 189. Rotate Array: https://leetcode.com/problems/rotate-array/description Brute Force O(n × k)Better O(n)Optimal O(n) and O(1) SpaceCode lines explained Brute Force O(n × k) The simplest way…

0 Comments
November 12, 2026
Uncategorized

54. Spiral Matrix – Solution [Brute-Force to Best]

Here’s the question link on LeetCode 54. Spiral Matrix: https://leetcode.com/problems/spiral-matrix/description Brute Force [Space - O(m × n)]Optimal [Space - O(1)] Brute Force [Space - O(m × n)] My first thought…

0 Comments
November 11, 2026
Uncategorized

74. Search a 2D Matrix – Solution [Brute-Force to Best]

Here’s the question link on LeetCode 74. Search a 2D Matrix: https://leetcode.com/problems/search-a-2d-matrix/description Brute O(n*m)Optimal O(log(n*m))Code Lines Explained Brute O(n*m) A brute-force way is to perform an n*m search every time:…

0 Comments
November 10, 2026
Uncategorized

53. Maximum Subarray – Solution [Brute-Force to Best]

Here's the question link on LeetCode 53. Maximum Subarray: https://leetcode.com/problems/maximum-subarray/description Brute O(n^2)Optimal - O(n)Why can we not use prefix sums?Why does Kadane's work? Brute O(n^2) Try all possible subarrays using…

0 Comments
November 9, 2026
  • 1
  • 2
  • 3
  • 4
  • …
  • 61
  • Go to the next page
Press Escape to close the search panel.

Categories

Recent Posts

  • 42. Trapping Rain Water – Solution [Brute-Force to Best]
  • 189. Rotate Array – Solution [Brute-Force to Best]
  • 54. Spiral Matrix – Solution [Brute-Force to Best]
  • 74. Search a 2D Matrix – Solution [Brute-Force to Best]
  • Home – python-hub
  • Contact Us
  • Privacy Policy
  • About Us
  • Projects
  • Basics
  • Quick Ref
  • CTk
  • Intermediate
  • Python GUI
  • OOP
  • Quizes
  • Advanced
  • Challenges
  • CodeCraft
  • Flutter
  • Tech Tool Spotlight
Copyright © - python-hub.com All Rights Reserved