Divide and conquer all leetcode problems.
Every one trys to learn various methods to solve leetcode problems. However, few people grasp the core of all algorithms and therefore most of us cannot solve novel problems we didn't seen before.
To overcome all these problems, I want to have a experiment on solving every leetcode problem with divide and conquer. If I can prove this, give me your star; If I fail, no regret.
- Use
divide-and conquer
purely. - Ok if pass all leetcode tests.
- Solutions should obey complexity (time and space) constraints of the problem.
To be practical, I only use Java and C++ for all experiments (although Scala and Rust are better). The world has not been prepared for everything.
- Java is terrible in the field of abstraction and expression.
- C++ is terrible at clean abstraction and full of traps.
We can classify divide-and-conquer
algorithms based on how they divide problems.
- Type 0: init part :+ the last element
- Type 1: Equally divide into two parts
For more details, please refer to the Strategy doc.
Fuck leetcode, long live divide-and-conquer
!