ProDeveloperTutorialonDecember 24, 2024 Merge Intervals in C++ Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output:… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given an array of non-negative integers determine if you are able to reach the last index in C++ Explanation: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] Output: [1,2,3,6,9,8,7,4,5] The Solution is very simple. As shown in the image… Discover More
ProDeveloperTutorialonDecember 24, 2024 Implement pow(x, n), which calculates x raised to the power n (xn) in C++ Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 Example 3: Input: 2.00000, -2 Output: 0.25000… Discover More
ProDeveloperTutorialonDecember 24, 2024 Rain water trapping Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after… Discover More
ProDeveloperTutorialonDecember 24, 2024 Group Anagrams in C++ Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate",… Discover More
ProDeveloperTutorialonDecember 24, 2024 You are given an n x n 2D matrix rotate it by 90 degrees (clockwise) in C++. Note: You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given a collection of numbers that might contain duplicates, return all possible unique permutations in C++ Example: Input: [1,1,2] Output: [ [1,1,2], [1,2,1], [2,1,1] ] In my pervious post we have discussed three solutions where the numbers are… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] The solution for this problem can be solved in 2… Discover More
ProDeveloperTutorialonDecember 24, 2024 Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Example 1: Input: num1 = "2", num2 = "3" Output: "6" Example 2: Input: num1 = "123", num2 =… Discover More