leetcode讲解--959. Regions Cut By Slashes

2018-12-30
阅读 4 分钟
2.8k
In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space. These characters divide the square into contiguous regions.

leetcode讲解--766. Toeplitz Matrix

2018-12-30
阅读 2 分钟
1.8k
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.

leetcode讲解--893. Groups of Special-Equivalent Strings

2018-12-30
阅读 2 分钟
1.8k
Two strings S and T are special-equivalent if after any number of moves, S == T.

leetcode讲解--872. Leaf-Similar Trees

2018-12-29
阅读 2 分钟
1.5k
Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence.

leetcode讲解--821. Shortest Distance to a Character

2018-12-29
阅读 2 分钟
1.7k
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.

leetcode讲解--806. Number of Lines To Write String

2018-12-28
阅读 2 分钟
1.5k
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an array widths, an array where widths[0] is the width...

leetcode讲解--811. Subdomain Visit Count

2018-12-27
阅读 3 分钟
1.9k
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leet...

leetcode讲解--885. Spiral Matrix III

2018-12-26
阅读 3 分钟
2k
On a 2 dimensional grid with R rows and C columns, we start at (r0, c0) facing east.

leetcode讲解--876. Middle of the Linked List

2018-12-26
阅读 2 分钟
2.6k
Given a non-empty, singly linked list with head node head, return a middle node of linked list.

leetcode讲解--559. Maximum Depth of N-ary Tree

2018-12-26
阅读 2 分钟
1.8k
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

leetcode讲解--867. Transpose Matrix

2018-12-26
阅读 1 分钟
1.5k
The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.

leetcode讲解--908. Smallest Range I

2018-12-26
阅读 2 分钟
1.8k
Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i].

leetcode讲解--700. Search in a Binary Search Tree

2018-12-26
阅读 2 分钟
1.7k
Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should return NULL.

leetcode讲解--883. Projection Area of 3D Shapes

2018-12-26
阅读 2 分钟
1.7k
On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes.

leetcode讲解--590. N-ary Tree Postorder Traversal

2018-12-26
阅读 3 分钟
2.2k
Given an n-ary tree, return the postorder traversal of its nodes' values.

leetcode讲解--589. N-ary Tree Preorder Traversal

2018-12-26
阅读 2 分钟
2.1k
Given an n-ary tree, return the preorder traversal of its nodes' values.

leetcode讲解--961. N-Repeated Element in Size 2N Array

2018-12-26
阅读 1 分钟
2.3k
In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times.

leetcode讲解--951. Flip Equivalent Binary Trees

2018-12-25
阅读 2 分钟
2.1k
For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.

leetcode讲解--922. Sort Array By Parity II

2018-12-25
阅读 1 分钟
2.2k
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.

leetcode讲解--933. Number of Recent Calls

2018-12-25
阅读 2 分钟
2.7k
It has only one method: ping(int t), where t represents some time in milliseconds.

leetcode讲解--763. Partition Labels

2018-12-25
阅读 2 分钟
2.4k
A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.

leetcode讲解--894. All Possible Full Binary Trees

2018-12-25
阅读 2 分钟
2.6k
A full binary tree is a binary tree where each node has exactly 0 or 2 children.

leetcode讲解--561. Array Partition I

2018-12-24
阅读 1 分钟
1.6k
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say $(a_1, b_1), (a_2, b_2), \cdots, (a_n, b_n)$ which makes sum of $min(a_i, b_i)$ for all i from 1 to n as large as possible.

leetcode讲解--861. Score After Flipping Matrix

2018-12-24
阅读 3 分钟
2.4k
A move consists of choosing any row or column, and toggling each value in that row or column: changing all 0s to 1s, and all 1s to 0s.

leetcode讲解--728. Self Dividing Numbers

2018-12-19
阅读 2 分钟
1.4k
A self-dividing number is a number that is divisible by every digit it contains.

我出面试题

2018-12-19
阅读 1 分钟
1.2k
在CSAPP(Computer Systems: A programmer's perspective,中文叫:深入理解计算机系统)中,有对汇编的栈工作原理的详细描述,这个底层的实现原理对程序员来说非常重要,算是一个基本功。

leetcode讲解--852. Peak Index in a Mountain Array

2018-12-19
阅读 1 分钟
1.4k
A.length >= 3There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.leng...

leetcode讲解--797. All Paths From Source to Target

2018-12-19
阅读 2 分钟
2.1k
Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order.

leetcode讲解--617. Merge Two Binary Trees

2018-12-18
阅读 2 分钟
1.5k
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.

leetcode讲解--942. DI String Match

2018-12-18
阅读 2 分钟
2.1k
Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length.