Remove Palindromic Subsequences Leetcode Solution

The problem Remove Palindromic Subsequences Leetcode Solution states that you are given a string. The string consists of only two characters ‘a’ or ‘b’. You are required to erase the whole string. There is a restriction that you can delete only a palindromic subsequence in one move. Find the minimum …

Read more

Maximum Nesting Depth of the Parentheses Leetcode Solution

Problem Statement In this problem, we are given a valid parentheses string (vps) having some numbers, some operators(e.g. +,-,*) and some parentheses(e.g. ‘(‘,’)’). Valid parentheses strings (vps) are:  “” “d” where d is any number “(A)” if A is valid parentheses string “A*B” if * is any operator and A …

Read more

Defanging an IP Address Leetcode Solution

Problem Statement In this problem, we are given an IP Address. We just have to convert it into a Defanged IP Address i.e. in our output string, all the “.” are converted to “[.]”. Example #1: address = “1.1.1.1” “1[.]1[.]1[.]1” #2: address = “255.100.50.0” “255[.]100[.]50[.]0” Approach 1 (Using String Stream/Builder) …

Read more

Is Subsequence Leetcode Solution

Problem Statement In this problem, we are given two different strings. The goal is to find out whether the first string is a subsequence of the second. Examples first string = “abc” second string = “mnagbcd” true first string = “burger” second string = “dominos” false Approach(Recursive) This is easy …

Read more

Compare Strings by Frequency of the Smallest Character Leetcode Solution

The problem Compare Strings by Frequency of the Smallest Character Leetcode Solution, states that we define a function f(s) over a non-empty string s such that f(s) is equal to the frequency of the smallest character in the string. Then we are given some words and some queries. for each …

Read more

Maximum Number of Balloons Leetcode Solution

Problem Statement In this problem, we are given a string of characters containing lower-case English letters. We need to find how many instances of the word “balloon” can we make using the characters of the given string. Example String = “banooll” 1 Explanation: String = baqwweeeertylln 0 Explanation: As the …

Read more

Student Attendance Record I Leetcode Solution

Problem statement In the problem ” Student Attendance Record I” we are given a string where each letter represents the attendance detail of a student. The interpretation of letters in the string is as follows: ‘A’ means absent. ‘P’ means present. ‘L’ means late The student will be rewarded based …

Read more

Translate »