MaxValueAfterRemovingFromString

https://leetcode.com/discuss/interview-question/1678850/Amazon-or-QA

You are given a binary string of length N consisting of 0’s and 1’s. You can remove a substring “01” to gain C0 coins and a substring “10” to gain C1 coins. After removing a substring the string will be divided into two parts and these two parts will get attach to each other to form one complete string. For example in string “11011” after removing “10” from string the two parts will be “1” and “11” now they will form one complete string as:111 So find the maximum value after removing all the substring("01" or "10") from string. 1<=N<=10^5

Last updated