ProDeveloperTutorialonDecember 24, 2024 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "()(())",…
ProDeveloperTutorialonDecember 24, 2024 Letter Combinations of a Phone Number Problem statement: Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could…
ProDeveloperTutorialonDecember 24, 2024 Remove Nth Node from End of List Problem description: Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list:…
ProDeveloperTutorialonDecember 24, 2024 Given an array n integers and an integer key, are there four elements a, b, c, and d in the array such that a + b + c + d = key? Find all unique quadruplets in the array which gives the sum of key. Note: The solution set must not contain duplicate quadruplets. Example: Given array nums = [1, 0, -1, 0, -2, 2], and target = 0. A solution…
ProDeveloperTutorialonDecember 24, 2024 Given an array of n integers and an integer “key”, find three integers in the array such that the sum is closest to key. Input: [-1, 2, 1, -4] Key = 1 Output: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2) This problem is also known as three sum…
ProDeveloperTutorialonDecember 24, 2024 Given an array, find 3 elements such that [a + b + c] = 0. Find all the 3 unique elements. This question can also be called as “three sum”. Input = [-1, 0, 1, 2, -1, -4], Output: [ [-1, 0, 1], [-1, -1, 2] ] This problem can be solved…
ProDeveloperTutorialonDecember 24, 2024 Given an array of non repeating numbers and a key, find all the unique combinations in that array, where the sum of those combination is equal to the key. Input: Array = [2,3,6,7], key = 7, Output: [ [7], [2,2,3] ] Example 2: Input: candidates = [2,3,5], target = 8, A solution set is: […
ProDeveloperTutorialonDecember 24, 2024 Find the Container with Most Water explanation with diagram and solution Problem description: Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines…
ProDeveloperTutorialonDecember 24, 2024 Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’. Note: ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element. Example 1: Input: Pattern:…
ProDeveloperTutorialonDecember 23, 2024 Longest Palindromic Substring In C++ Given a string, find the longest palindromic string in that array. A palindromic string will give the same string when read reverse. Example:…