Skip to Content
LeetCode The Hard Way

1500 - 1599

Solutions categorised by Problem IDs

1502 - Can Make Arithmetic Progression From SequenceCheck whether a sequence can form an arithmetic progression by sorting it and comparing consecutive differences.1510 - Stone Game IVDetermine whether the first player can win the square-removal stone game by finding moves to losing states.1514 - Path with Maximum ProbabilityFind the path with the highest success probability by adapting Dijkstra's algorithm to products of edge probabilities.1519 - Number of Nodes in the Sub-Tree With the Same LabelCount same-label descendants for every tree node by aggregating letter frequencies from child subtrees.1523 - Count Odd Numbers in an Interval RangeCount odd integers in an inclusive interval using its endpoints without enumerating every value.1531 - String Compression IIMinimize run-length encoding size after deletions by tracking which characters to keep and when encoded run lengths change.1539 - Kth Missing Positive NumberLocate the kth missing positive integer by tracking gaps in the increasing sequence.1544 - Make The String GreatRemove adjacent copies of a letter with opposite case and account for new pairs exposed by each removal.1547 - Minimum Cost to Cut a StickMinimize stick-cutting cost by choosing the first cut in each interval and combining the best remaining costs.1550 - Three Consecutive OddsDetect three consecutive odd numbers by checking the parity of neighboring array elements.1572 - Matrix Diagonal SumAdd both diagonals of a square matrix and count their shared center only once.1575 - Count All Possible RoutesCount routes that reach the destination within the fuel budget by tracking the current city and remaining fuel.1578 - Minimum Time to Make Rope ColorfulMake adjacent balloon colors different at minimum removal cost by keeping the most expensive balloon in each same-color run.1584 - Min Cost to Connect All PointsConnect all points at minimum total Manhattan distance by building a minimum spanning tree with Kruskal's or Prim's algorithm.1588 - Sum of All Odd Length SubarraysSum all odd-length subarrays by enumerating them or counting how often each element contributes to the total.1590 - Make Sum Divisible by PFind the shortest removable subarray that makes the remaining sum divisible by p using prefix remainders and a hash map.