Problem Statement: You are given a string. You need to partition the string in such a way that, each substring is a palindrome. Example Input: s = "abb" Output: , ] Solution The solution in very simple. We will use backtracking approach to solve this …
Problem Statement: You are given 3 arrays that represents a stack. You need to remove the top elements of the stack such that the sum of all the stacks are equal. Example stack1 = {4, 3, 2} stack2 = {3, 2, 1, 1, 1} stack3 = …
Problem Statement: You are given n ropes of different length. You need to connect these ropes into one rope. The cost of connecting two ropes is equal to the sum of their lengths. Example Input : {4, 3, 2, 6} Output: 29 Connect 2, 3 …
Problem Statement: You are given 2 string and you need to check if some permutation of s1 can break s2 or vice-versa. A string can break another string if s1 >= s2 for all i from 0 to n-1 Example Input: s1 = "abc", s2 …
Problem Statement: You are given a list of intervals, you need to remove all the intervals that are covered by other intervals and return the number of intervals remaining. Example Input: intervals = ,,] Output: 2 The interval is covered by , hence can be removed. …
Problem Statement: You are given a string of ‘(‘ and ‘)’. You need to return the minimum number of parentheses to make the string valid. Example Input: "())" Output: 1 Solution Solution is simple. We take 2 variables, "open" will represent '(' to add …
Problem Statement: You are selling a Juice for RS 5. Initially you will not have any change left with you. Customers can buy the juice with either “5”, “10” or “20” RS. You need to provide them with exact change, and you need to return true …