[C++/Python] Longest Non-Decreasing Subsequence - Clean & Concise
Idea\n- If k = 1, we need to find the minimum number of operations to make the whole array non-decreasing.\n- If k = 2, we need to make:\n\t- newArr1: Elements 
**Idea**\n- If `k = 1`, we need to find the minimum number of operations to make the whole array non-decreasing.\n- If `k = 2`, we need to make:\n\t- newArr1: Elements in index [0, 2, 4, 6...] are non-decreasing.\n\t- newArr2: Elements in index [1, 3, 5, 7...] are non-decreasing.\n- If `k = 3`, we need to make:\n    - newArr1: Elements in index [0, 3, 6, 9...] are non-decreasing.\n\t- newArr2: Elements in index [1, 4, 7, 10...] are non-decreasing.\n\t- newArr3: Elements in index [2, 5, 8, 11...] are non-decreasing.\n- Since **Elements in newArrs are independent**, we just need to **find the minimum of operations to make `K` newArr non-decreasing**.\n- To **find the minimum of operations to make an array non-decreasing**,\n\t- Firstly, we count **Longest Non-Decreasing Subsequence** in that array.\n\t- Then the result is `len(arr) - longestNonDecreasing(arr)`, because we only need to change elements not in the **Longest Non-Decreasing Subsequence**.\n\t- For example: `newArr = [18, 8, 8, 3, 9]`, the longest non-decreasing subsequence is `[-, 8, 8, -, 9]` and we just need to change the array into `[8, 8, 8, 9, 9]` by changing `18 -> 8`, `3 -> 9`.\n\n**To find the Longest Non-Decreasing Subsequence** of an array, you can check following posts for more detail:\n- [300. Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/discuss/1326308) - Longest Increasing Subsequence\n- [1964. Find the Longest Valid Obstacle Course at Each Position](https://leetcode.com/problems/find-the-longest-valid-obstacle-course-at-each-position/discuss/1390159) - Longest Non-Decreasing Subsequence\n\n<iframe src="https://leetcode.com/playground/Mo4LhKNV/shared" frameBorder="0" width="100%" height="550"></iframe>\n\n**Complexity**\n- Time: `O(K * N/K * log(N/K))`  = `O(N * log(N/K))`, where `N <= 10^5` is length of `arr`, `K <= N`.\n\t- We have total `K` new arr, each array have up to `N/K` elements.\n\t- We need `O(M * logM)` to find the longest non-decreasing subsequence of an array length `M`.\n- Space: `O(N / K)`\n\n
[]