LeetCode 189.
Intuition keep a subarray of right side of array and replace right side of it by left side. After that, replace the other side.
Intuition keep a subarray of right side of array and replace right side of it by left side. After that, replace the other side.
Intuition An intuitive thought: iterate the given array and record the steps that number on current index needed to be replaced forward. Then, this implemen...
Intro Approach 1 gives the method to test whether n is a prime number.
Intuition On first glimpse, I try DP and turn out TLE, shit again.
Intuition Binary Seaching to find the answer