题目: Given an array of integers, find two numbers such that they add up to a specific target number. The functi…
分类:LeetCode题目解答汇总
LeetCode | First Missing Positive(第一个缺失的正整数)
Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] …
LeetCode | Reverse Nodes in k-Group(k个结点一组翻转链表)
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If…
LeetCode | Single Number II(单个数字II)
Given an array of integers, every element appears three times except for one. Find that single one. …
LeetCode | Sort Colors(荷兰国旗问题)
Given an array with n objects colored red, white or blue, sort them so that objects of the same colo…
LeetCode | Surrounded Regions(包围的区域)
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region i…
LeetCode | Triangle(三角形路径和)
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on …
LeetCode | Gas Station(加油站)
There are N gas stations along a circular route, where the amount of gas at station i is&n…
LeetCode | Palindrome Number(回文数字)
题目: Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hi…
LeetCode | Path Sum II(路径和2)
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. F…
LeetCode | Letter Combinations of a Phone Number(号码的字符串组合)
Given a digit string, return all possible letter combinations that the number could represent. A mapping of di…
LeetCode | Spiral Matrix II(螺旋矩阵填充数据)
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.…