Answer: Flipkart, 28th October, Recently Asked for On-Campus Assessments

Answer · Posted Nov 2022

Solution for question 3 This problem can be solved using dp. The states of dp will be i, j, isDeletedOnce i represents the current index of the drawString j represents the current index of the ticket isDeletedOnce is boolean, and represents if the character is deleted once in the ticket. dp[i][j][isDeletedOnce] will store the minimum characters needed to be removed from the drawString. We will check for every i from 0 to drawString.length()-1, that if dp[i][j][isDeletedOnce] < = tolerance, then ...

The full answer & interview discussion are available to premium members.

Log in Create a free account