Camelcase Matching Leetcode Solution

Problem Statement: Camelcase Matching Leetcode Solution says that – Given an array of string “queries” and string “pattern”, return boolean array result where result[i] is true where “queries[i]” matches with “pattern”, false otherwise. A query word “queries[i]” matches with “pattern” if you can insert some lowercase English letters in “pattern” so …

Read more

Step-By-Step Directions From a Binary Tree Node to Another LeetCode Solution

Problem Statement: Step-By-Step Directions From a Binary Tree Node to Another LeetCode Solution – You are given the root of a binary tree with n nodes. Each node is uniquely assigned a value from 1 to n. You are also given an integer startValue representing the value of the start node s, and a different integer destValue representing the value of the destination …

Read more

Score of Parenthesis LeetCode Solution

Problem Statement The score of Parenthesis LeetCode Solution says – Given a balanced parentheses string s and return the maximum score. The score of a balanced parenthesis string is based on the following rules: “()” has score 1. AB has score A + B, where A and B are balanced parenthesis strings. (A) has score 2 * A, where A is a …

Read more

Design Add and Search Words Data Structure LeetCode Solution

Problem Statement: Design Add and Search Words Data Structure LeetCode Solution says – Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictionary() Initializes the object. void addWord(word) Adds word to the data structure, it can be matched later. bool search(word) Returns true if there …

Read more

Detect Capital Leetcode Solution

Problem Statement: Detect Capital Leetcode Solution says that – Given a string, return true if the usage of capitals in it is right. The conditions for the right words are : All letters in this word are capitals, like “UK”. All letters in this word are not capitals, like “going”. Only …

Read more

Decode String Leetcode Solution

Problem Statement The Decode String LeetCode Solution – “Decode String” asks you to convert the encoded string into a decoded string. The encoding rule is k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times where k is a positive integer. Example: Input: s = “3[a]2[bc]” Output: “aaabcbc” …

Read more

Substring with Concatenation of All Words Leetcode Solution

Problem Statement The Substring with Concatenation of All Words LeetCode Solution – “Substring with Concatenation of All Words” states that given a string s and an array of string words where each word is of the same length. We need to return all starting indices of the substring that is …

Read more

Different Ways to Add Parentheses Leetcode Solution

Problem Statement The Different Ways to Add Parentheses LeetCode Solution – “Different Ways to Add Parentheses” states that given a string expression of numbers and operators. We need to return all possible results from computing all different possible ways to group numbers and operators. Return the answer in any order. …

Read more

Translate »