Given a matrix of m x n elements (m rows, n columns), return all elements o…
标签:LeetCode题目解答汇总
LeetCode | Insert Interval(插入区间)
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa…
LeetCode | Set Matrix Zeroes(矩阵相应行列清零)
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in pla…
LeetCode | Longest Common Prefix(最长公共前缀)
题目: Write a function to find the longest common prefix string amongst an array of strings. 求一系列字符串的公共字符串前缀。 题目…
LeetCode | Spiral Matrix II(螺旋矩阵填充数据)
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.…
LeetCode | Generate Parentheses(生成括号)
Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthes…
LeetCode | Reorder List(链表重新排序)
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must …
LeetCode | Edit Distance(字符串编辑距离)
Given two words word1 and word2, find the minimum number of steps required to convert word…
LeetCode | Decode Ways(译码方式)
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -…
LeetCode | Gas Station(加油站)
There are N gas stations along a circular route, where the amount of gas at station i is&n…
LeetCode | Remove Nth Node From End of List(移除链表中倒数第n个结点)
题目: Given a linked list, remove the nth node from the end of list and return its head. For example, …
LeetCode | Triangle(三角形路径和)
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on …