ProDeveloperTutorialonDecember 25, 2024 Remove Duplicates from Sorted List solution in CPP Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1:… Discover More
ProDeveloperTutorialonDecember 25, 2024 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]). You are given a target value to search. If found in the array return true, otherwise… Discover More
ProDeveloperTutorialonDecember 25, 2024 Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1: Given… Discover More
ProDeveloperTutorialonDecember 25, 2024 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuration of the… Discover More
ProDeveloperTutorialonDecember 25, 2024 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Example: Input: nums = [1,2,3] Output: [ [3], [1], [2], [1,2,3], [1,3], [2,3],… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given two integers n and k, return all possible combinations of k numbers out of 1 … n. Example: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] This problem can be solved in 2 ways. 1. Iterative 2.… Discover More
ProDeveloperTutorialonDecember 24, 2024 Sort Colors In Place We can solve this by many different ways. Solution 1 Will be counting all the number of 0’s, 1’s and 2’s. Then insert those number of… Discover More
ProDeveloperTutorialonDecember 24, 2024 Search a 2D Matrix in C++ Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: Input: [ [1,1,1], [1,0,1], [1,1,1] ] Output: [ [1,0,1], [0,0,0], [1,0,1] ] Example 2: Input: [ [0,1,2,0], [3,4,5,2], [1,3,1,5] ]… Discover More