Problem Statement: You are given a string with 2N characters consisting of equally “” brackets. They are unbalanced, you need to find the minimum swaps required for them to make balanced. Example Input : ]] Solution The solution is very simple. We take …
Problem Statement: You are given a roman numeral, you need to convert into it’s corresponding decimal value. Example Input: IX Output: 9 Solution The solution is very simple. We need to know what each roman numeral maps to decimal. Symbol Value I 1 …
Problem Statement: You are given a string and a 2D char array. You need to count the number of times the string is there in the 2D array. The individual character can be present left to right, right to left, top to down or down to …
Problem Statement: You are given a string, you need to convert that string into its equivalent mobile numeric keypad sequence. Example Input : HELLO WORLD Output : 4433555555666096667775553 Solution The solution is very simple. For each character, we will store the sequence of that …
Problem Statement: You are given a string, you need to find the maximum count of substrings with equal number of 0s and 1s. Example Input: “0100110101” Output: 4 The substrings are “01”, “0011”, “01” and “01”. Solution The solution is very simple. We take a …
Problem Statement: You are given a string, you need to find all the permutations of it. Example Input: abc Output: ABC ACB BAC BCA CBA CAB Solution To solve this problem we shall use the concept of backtracking. Here we will swap each of the …