摘要:题目:验证二叉搜索树 难度:Medium 题目内容: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subt
阅读全文
摘要:题目:解码方法数 难度:Medium 题目内容: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 2
阅读全文
摘要:题目:合并已排序数组 难度:Easy 题目内容: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 翻译: 给定两个排序的整数数组nums1和nums2,将nums
阅读全文
摘要:题目:最大的矩形柱状图 难度:hard 题目内容: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of lar
阅读全文
摘要:题目:矩阵单词搜索 难度:Medium 题目内容: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially a
阅读全文
摘要:题目:矩阵置0 难度:Easy 题目内容: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain dup
阅读全文
摘要:题目:矩阵置0 难度:Easy 题目内容: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Given a m x n matrix, if an elemen
阅读全文
摘要:题目:求平方根 难度:Easy 题目内容: Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer
阅读全文
摘要:题目:数组加一 难度:Easy 题目内容: Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that
阅读全文
摘要:题目:唯一路径(机器人走方格) 难度:Medium 题目内容: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only mo
阅读全文
摘要:题目:合并区间 难度:Medium 题目内容: Given a collection of intervals, merge all overlapping intervals. Given a collection of intervals, merge all overlapping inter
阅读全文
摘要:题目:跳跳游戏 难度:Medium 题目内容: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the arr
阅读全文
摘要:题目:螺旋矩阵 难度:Medium 题目内容: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. 翻译: 给定一个m x n元素的矩阵(m行
阅读全文
摘要:题目:和最大的子序列 难度:Medium 题目内容: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and re
阅读全文
摘要:题目:求x的n次幂 难度:Medium 题目内容: Implement pow(x, n), which calculates x raised to the power n (xn). 翻译: 实现计算x的n次幂。 Example 1: Example 2: Example 3: Note: -1
阅读全文
摘要:题目:同字符分组 难度:Medium 题目内容: Given an array of strings, group anagrams together. 翻译:给定一组字符串数组,按相同字符组成的字符串分为一组。 Example: 我的思路:因为要分组,那么使用map即可,相同的字符作为键,值为一个
阅读全文
摘要:题目:求所有全排列 难度:Medium 题目内容: Given a collection of distinct integers, return all possible permutations. 翻译:给定一组各不相同的整数,返回所有可能的排列。 Example: 我的思路:每种情况中,每一个
阅读全文
摘要:题目:矩阵旋转 难度:Medium 题目内容: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate t
阅读全文
摘要:题目:通配符匹配 难度:hard 题目内容: Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. The matching sho
阅读全文
摘要:题目:接雨水 难度:hard 题目内容: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able t
阅读全文