Contains Duplicate LeetCode Solution
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Contains Duplicate LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Contains Duplicate LeetCode Solution Read More »
Leetcode SolutionGiven an array nums of size n, return the majority element. The majority element is the element that appears more than [n / 2] times. You may assume that the majority element always exists in the array.
Majority Element LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i – j) <= k.
Contains Duplicate II LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed.
Remove Element LeetCode Solution Read More »
Leetcode SolutionGiven an array of integers nums, find the next permutation of nums.
Next Permutation LeetCode Solution Read More »
Leetcode SolutionGiven the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
Search in Rotated Sorted Array LeetCode Solution Read More »
Leetcode SolutionWrite a program to solve a Sudoku puzzle by filling the empty cells.
Sudoku Solver LeetCode Solution Read More »
Leetcode SolutionGiven an array of integers heights representing the histogram’s bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.
Largest Rectangle in Histogram LeetCode Solution Read More »
Leetcode SolutionGiven a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
Search Insert Position LeetCode Solution Read More »
Leetcode SolutionGiven an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.
Permutations LeetCode Solution Read More »
Leetcode SolutionGiven an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.
Combination Sum LeetCode Solution Read More »
Leetcode SolutionGiven a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.
Combination Sum II LeetCode Solution Read More »
Leetcode SolutionGiven an unsorted integer array nums, return the smallest missing positive integer.
First Missing Positive LeetCode Solution Read More »
Leetcode SolutionGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
Trapping Rain Water LeetCode Solution Read More »
Leetcode SolutionYou are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where: 0 <= j <= nums[i] and i + j < n. Return the minimum number of jumps to reach nums[n - 1].
Jump Game II LeetCode Solution Read More »
Leetcode Solution