Container With Most Water LeetCode Solution

Problem Statement Container With Most Water LeetCode Solution says that – You are given an integer array height of length n. There are n vertical lines are drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the container …

Read more

Valid Anagram Leetcode Solution

Problem Statement Valid Anagram Leetcode Solution – Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: s = “anagram”, t = “nagaram” Output: …

Read more

Sentence Screen Fitting LeetCode Solution

Problem Statement: Sentence Screen Fitting LeetCode Solution: Given a rows x cols screen and a sentence represented as a list of strings, return the number of times the given sentence can be fitted on the screen. The order of words in the sentence must remain unchanged, and a word cannot be split into two lines. A …

Read more

Minimum Number of Arrows to Burst Balloons LeetCode Solution

Problem Statement: Minimum Number of Arrows to Burst Balloons LeetCode Solution: There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and xend. You do not know the exact y-coordinates of …

Read more

Flatten Binary Tree to Linked List LeetCode Solution

Problem Statement: Flatten Binary Tree to Linked List LeetCode Solution: Given the root of a binary tree, flatten the tree into a “linked list”: The “linked list” should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. The “linked list” should be …

Read more

Next Greater Element II LeetCode Solution

Problem Statement Next Greater Element II LeetCode Solution – Given a circular integer array nums (i.e., the next element of nums[nums.length – 1] is nums[0]), return the next greater number for every element in nums. The next greater number of a number x is the first greater number to its traversing order next in the array, which means you could search …

Read more

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

Translate »