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

Translate »