Convert Roman Number to Decimal | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement Roman numerals are represented by seven different symbols: I, V, X, L, C, D, and M. Symbol  --> Value I  --> 1 V  --> 5 X  --> 10 L  --> 50 C  --> 100 D  --> 500 M  --> 1000 For example, Two is written as II in Roman numeral, just two one’s added Read More

Ransom Note | String Problem | LeetCode 383

4 years ago Lalit Bhagtani 0
Problem Statement You have given a ransom note string and a string consists of all of the letters of the magazine. Write a program to find out if a ransom note can be constructed from the magazine. Each letter in the magazine string can only be used once in the ransom note. Note:- Both strings Read More

Rotated Digits | String Problem | LeetCode 788

4 years ago Lalit Bhagtani 0
Problem Statement A number N is a good number if after rotating each digit individually by 180 degrees, we get a valid number which is different from N. A number is valid if each digit remains a digit after rotation. following is the list of digits and its rotated state. 0  --> 0 1  -->  Read More

Robot Return to Origin | String Problem | LeetCode 657

4 years ago Lalit Bhagtani 0
Problem Statement There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, check if the robot ends up at the origin (0, 0) after it completes its all the moves. The sequence of moves is represented by a string, and the character at i Read More

Split String into Balanced Strings | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a balanced string S, split it into the maximum amount of balanced strings. Note :- Balanced strings are the strings, which have an equal number of “A” and “B” characters. Example  Input :- S = "ABAABBABAB" Output :- 4 Input :- S = "ABAABBABABBBAAAB" Output :- 6 Solution Traverse the Read More

Group Anagrams | String Problem | LeetCode 49

4 years ago Lalit Bhagtani 1
Problem Statement You have given an array of strings, write a program to group all the anagrams. Note :- Strings consists of only lowercase English letters. Example  Input :- Output :- , , ] Input :- , Output :- , , Read More

Find All Anagrams in a String | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given two strings S and T, find out all the start indices of S anagrams in T. Note :- Strings consists of only lowercase English letters. Example  Input :- S = "abc" T = "cbaebabacd" Output :- Input :- S = "ab" T = "abab" Output :- Read More

Valid Anagram | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given two strings S and T, find out if T is an anagram of S. Example  Input :- S = "anagram" T = "nagaram" Output :- true Input :- S = "sun" T = "car" Output :- false Solution This problem can be solved in following steps :- Create the character Read More

Detect Capital in String | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a word, find out if the usage of capital letters in the given word is correct or not. Correct Usage of capital letters are defined as:- Word contains all capital letters like, “HELLO” Word contains no capital letters like, “hello” Only the first letter of the word is a capital, Read More