[LeetCode] 445. Add Two Numbers II

2018-12-05
阅读 2 分钟
1.4k
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

[LeetCode] 727. Minimum Window Subsequence

2018-12-05
阅读 2 分钟
3k
Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.

[LeetCode] 911. Online Election

2018-12-05
阅读 2 分钟
2.1k
In an election, the i-th vote was cast for persons[i] at time times[i].

[LeetCode] 839. Similar String Groups

2018-12-05
阅读 3 分钟
1.9k
Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y.

[LeetCode] 684. Redundant Connection

2018-12-04
阅读 2 分钟
1.7k
In this problem, a tree is an undirected graph that is connected and has no cycles.

[LeetCode] 803. Bricks Falling When Hit

2018-12-04
阅读 4 分钟
2.5k
We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent bricks will not drop.

[LeetCode] 739. Daily Temperatures

2018-12-03
阅读 1 分钟
2.1k
Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.

[LeetCode] 222. Count Complete Tree Nodes

2018-12-03
阅读 1 分钟
1.9k
Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.

[LeetCode] 562. Longest Line of Consecutive One in Matrix

2018-12-03
阅读 2 分钟
3.6k
Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line could be horizontal, vertical, diagonal or anti-diagonal.Example:Input:[[0,1,1,0], [0,1,1,0], [0,0,0,1]]Output: 3Hint: The number of elements in the given matrix will not exceed 10,000.

[LeetCode] 846. Hand of Straights

2018-12-03
阅读 2 分钟
2.5k
Now she wants to rearrange the cards into groups so that each group is size W, and consists of W consecutive cards.

[LeetCode] 857. Minimum Cost to Hire K Workers

2018-12-03
阅读 2 分钟
2.2k
There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i].

[LeetCode] 859. Buddy Strings

2018-12-03
阅读 2 分钟
2.3k
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.

[LeetCode] 815. Bus Routes

2018-12-03
阅读 2 分钟
2.7k
We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that the first bus (0-th indexed) travels in the sequence 1->5->7->1->5->7->1->... forever.

[LeetCode] 929. Unique Email Addresses

2018-12-03
阅读 2 分钟
2.1k
Every email consists of a local name and a domain name, separated by the @ sign.

[LeetCode] 312. Burst Balloons

2018-12-03
阅读 2 分钟
1.6k
Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[left] nums[i] nums[right] coins. Here left and right are adjacent indices of i. After the burst, th...

[LeetCode] 299. Bulls and Cows

2018-12-03
阅读 2 分钟
1.2k
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and posi...

[LeetCode] 86. Partition List

2018-12-02
阅读 1 分钟
2k
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.

[LeetCode] 947. Most Nodes Removed

2018-12-02
阅读 2 分钟
2.1k
On a 2D plane, we place stones at some integer coordinate points. Each coordinate point may have at most one stone.

[LeetCode] 315. Count of Smaller Numbers After Self

2018-12-02
阅读 2 分钟
2.2k
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].

[LeetCode] 490. The Maze (BFS/DFS)

2018-11-27
阅读 4 分钟
5.8k
There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction.

[LeetCode] 348. Design Tic-Tac-Toe

2018-11-27
阅读 3 分钟
2.6k
Design a Tic-tac-toe game that is played between two players on a n x n grid.

[LeetCode] 120. Triangle

2018-11-27
阅读 2 分钟
2k
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

[LeetCode] 501. Find Mode in Binary Search Tree

2018-11-27
阅读 2 分钟
3k
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.

[LeetCode] 662. Maximum Width of Binary Tree

2018-11-26
阅读 2 分钟
2.6k
Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a full binary tree, but some nodes are null.

[LeetCode] 248. Strobogrammatic Number III

2018-11-26
阅读 2 分钟
3.2k
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).

[LeetCode] 247. Strobogrammatic Number II

2018-11-26
阅读 2 分钟
2.1k
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).

[LeetCode] 862. Shortest Subarray with Sum at Least K

2018-11-26
阅读 2 分钟
3.2k
Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K.

[LeetCode] 209. Minimum Size Subarray Sum (Easy version LC 862)

2018-11-26
阅读 1 分钟
1.6k
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.

[LeetCode] 708. Insert into a Cyclic Sorted List

2018-11-26
阅读 3 分钟
4.4k
Given a node from a cyclic linked list which is sorted in ascending order, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be a reference to any single node in the list, and may not be necessarily the smallest value in the cyclic list.

[LeetCode] 491. Increasing Subsequences

2018-11-26
阅读 2 分钟
2.5k
Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 .