LeedCode
Problems
2-D Dynamic Programming
27 remaining tasks
0062 - Unique Paths
Easy
0063 - Unique Paths II
Easy
1143 - Longest Common Subsequence
Easy
0516 - Longest Palindromic Subsequence
Easy
1049 - Last Stone Weight II
Easy
0309 - Best Time to Buy And Sell Stock With Cooldown
Easy
0518 - Coin Change II
Easy
0494 - Target Sum
Easy
0097 - Interleaving String
Easy
0877 - Stone Game
Easy
0064 - Minimum Path Sum
Easy
0329 - Longest Increasing Path In a Matrix
Easy
0221 - Maximal Square
Easy
0474 - Ones and Zeroes
Easy
5782 - Maximum Alternating Subsequence Sum
Easy
0115 - Distinct Subsequences
Easy
0072 - Edit Distance
Easy
1220 - Count Vowels Permutation
Easy
0312 - Burst Balloons
Easy
1866 - Number of Ways to Rearrange Sticks With K Sticks Visible
Easy
0010 - Regular Expression Matching
Easy
1140 - Stone Game II
Easy
0926 - Flip String to Monotone Increasing
Easy
2218 - Maximum Value of K Coins from Piles
Easy
1639 - Number of Ways to Form a Target String Given a Dictionary
Easy
0879 - Profitable Schemes
Easy
1547 - Minimum Cost to Cut a Stick
Easy
0926 - Flip String to Monotone Increasing
Easy
Javascript
Code
/**
 * @param {string} s
 * @return {number}
 */
var minFlipsMonoIncr = function (s) {
    let [res, countOne] = [0, 0];

    for (ch of s) {
        if (ch == '1') {
            countOne++;
        } else {
            res = Math.min(res + 1, countOne);
        }
    }

    return res;
};
Mark as complete
Close
Shortcut: Ctrl + .
Shortcut: Ctrl + /