Symmetric Tree Leetcode Solution

Problem Statement The Symmetric Tree LeetCode Solution – “Symmetric Tree” states that given the root of the binary tree and we need to check if the given binary tree is a mirror of itself (symmetric around its center) or not? If Yes, we need to return true otherwise, false. Example: …

Read more

Count and Say Leetcode Solution

Problem Statement The Count and Say LeetCode Solution – “Count and Say” asks you to find the nth term of the count-and-say sequence. The count-and-say sequence is a sequence of digit strings defined by the recursive formula: countAndSay(1) = “1” countAndSay(n) is the way you would “say” the digit string from countAndSay(n-1), which is then converted …

Read more

Maximum Frequency Stack Leetcode Solution

Problem Statement The Maximum Frequency Stack LeetCode Solution – “Maximum Frequency Stack” asks you to design a frequency stack in which whenever we pop an element from the stack, it should return the most frequent element present in the stack. Implement the FreqStack class: FreqStack() constructs an empty frequency stack. void push(int val) pushes …

Read more

Set Matrix Zeroes Leetcode Solution

Problem Statement The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” states that you’re given an m x n integer matrix matrix.We need to modify the input matrix such that if any cell contains the element  0, then set its entire row and column to 0‘s. You must do it in …

Read more

Translate »