DSA Problems

Problems, explained so they click

One problem at a time: the slow idea first, then the trick that makes it fast, a visual you can step through, and clean code in Python, Java and C++.

18 Nov 2026Hard

2911. Minimum Changes to Make K Semi-palindromes

Cut a string into k pieces so the fewest letters need changing to make every piece a semi-palindrome: price every piece once, then pick the cuts with DP.

  • Partition DP
  • Precomputation
  • Palindromes
  • Divisors & Number Theory
  • Two Pointers
LeetCode · Visual walkthrough · Python, Java, C++Solve it with me
  1. 16 Nov 20261524. Number of Sub-arrays With Odd SumPrefix Sum · Parity & Modulo · Counting PairsMedium