原创 Leetcode之Angle Between Hands of a Clock

題目: Given two numbers, hour and minutes. Return the smaller angle (in sexagesimal units) formed between the hour and th

原创 Leetcode之Wiggle Subsequence

題目: A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate

原创 Leetcode之Deepest Leaves Sum

題目: Given a binary tree, return the sum of values of its deepest leaves. Example 1: Input: root = [1,2,3,4,5,null,6,7

原创 Leetcode之Count Numbers with Unique Digits

題目: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Input: 2 Outp

原创 Leetcode之Russian Doll Envelopes

題目: You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit int

原创 Leetcode之Knight Probability in Chessboard

題目: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The row

原创 Leetcode之 Path Sum III

題目: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a gi

原创 Leetcode之 Binary Search Tree to Greater Sum Tree

題目: Given the root of a binary search tree with distinct values, modify it so that every node has a new value equal to

原创 Leetcode之Split Array into Fibonacci Sequence

題目: Given a string S of digits, such as S = "123456579", we can split it into a Fibonacci-like sequence [123, 456, 579]

原创 Leetcode之Word Pattern

題目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that t

原创 Leetcode之Concatenated Words

題目: 代碼: 方法一——: class Solution { public: vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {

原创 Leetcode之Rotate Function

題目: Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A 

原创 Leetcode之Single Element in a Sorted Array

題目: You are given a sorted array consisting of only integers where every element appears exactly twice, except for one

原创 Leetcode之Max Sum of Rectangle No Larger Than K

題目: Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its su

原创 Leetcode之 Can I Win

題目: In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first