Segment Tree LeetCode Problems: All 41,
With Python Solutions

Every problem in this library that LeetCode tags Segment Tree. 33 of them carry a complete Python solution, a worked example and the time and space complexity of the approach.

Easy
0
Medium
11
Hard
30

Segment Tree problems by difficulty

Problems with a complete Python solution are listed first, then by ascending problem number.

Medium (11)

Medium problems
No.Problem
0307Range Sum Query - Mutable
0406Queue Reconstruction by Height
0673Number of Longest Increasing Subsequence
0729My Calendar I
0731My Calendar II
1395Count Number of Teams
2080Range Frequency Queries
2424Longest Uploaded Prefix
0308Range Sum Query 2D - MutablePremium
2031Count Subarrays With More Ones Than ZerosPremium
2907Maximum Profitable Triplets With Increasing Prices IPremium

Hard (30)

Hard problems
No.Problem
0218The Skyline Problem
0315Count of Smaller Numbers After Self
0327Count of Range Sum
0493Reverse Pairs
0699Falling Squares
0715Range Module
0732My Calendar III
0850Rectangle Area II
1157Online Majority Element In Subarray
1505Minimum Possible Integer After at Most K Adjacent Swaps On Digits
1521Find a Value of a Mysterious Function Closest to Target
1622Fancy Sequence
1649Create Sorted Array through Instructions
1687Delivering Boxes from Storage to Ports
2179Count Good Triplets in an Array
2213Longest Substring of One Repeating Character
2276Count Integers in Intervals
2286Booking Concert Tickets in Groups
2407Longest Increasing Subsequence II
2426Number of Pairs Satisfying Inequality
2569Handling Sum Queries After Update
2659Make Array Empty
2736Maximum Sum Queries
2926Maximum Balanced Subsequence Sum
2940Find Building Where Alice and Bob Can Meet
0683K Empty SlotsPremium
2158Amount of New Area Painted Each DayPremium
2519Count the Number of K-Big IndicesPremium
2916Subarrays Distinct Element Sum of Squares II
2921Maximum Profitable Triplets With Increasing Prices IIPremium

Eyes only

When the Segment Tree problem arrives live.

In the live round, Stealth Interview reads the problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer says. It's a desktop app for macOS and Windows, invisible to screen sharing.