3Sum
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once.
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
Given 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.
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the...
For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return false.
Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.
Given a string s containing only digits, return the number of ways to decode it.
Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array.
A peak element is an element that is strictly greater than its neighbors.
Given an unsorted integer array nums, return the smallest missing positive integer.
Given an integer array nums representing the amount of money of each house, return *the maximum amount of money you can rob tonight without alerting the police.
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle.
Given an integer array nums, return the length of the longest strictly increasing subsequence.
Given a string s, return the longest palindromic substring in s.
Given a string s, find the length of the longest substring without repeating characters.
Given an integer array nums, find the subarray which has the largest sum and return its sum.
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.
There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges.
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.
Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum.
Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.
Given 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.
Given the head of a linked list, return the list after sorting it in ascending order.
Given an m x n matrix, return all elements of the matrix in spiral order.
Given an integer array nums of unique elements, return all possible subsets (the power set).
Given an integer array nums that may contain duplicates, return all possible subsets (the power set).
Write a program to solve a Sudoku puzzle by filling the empty cells.
There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0])...
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.
Given an m x n grid of characters board and a string word, return true if word exists in the grid.
Given an m x n board of characters and a list of strings words, return all words on the board.