DocumentationAlgorithmsGreedy vs DPGreedy vs DP Greedy Keys Have a optimal solutio in every step. It’s not necessary the optimal solution though. Each step DP Steps: 1.Last updated on February 24, 2026Dynamic ProgrammingMajority Element: Boyer–Moore majority vote