摘要:
In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given
阅读全文
posted @ 2020-12-29 12:21
Grandyang
阅读(1996)
推荐(0)
摘要:
Given an array of integers , find the number of triples of indices (i, j, k) such that: `0 这道题给了一个数组,定义了一种三元组,使得这三个数字相‘与’得到为0,问有多少种不同的组合。根据题目中的例子可以发现,
阅读全文
posted @ 2020-12-28 11:07
Grandyang
阅读(534)
推荐(0)
摘要:
Create a timebased key value store class , that supports two operations. 1\. Stores the and , along with the given . 2\. Returns a value such that was
阅读全文
posted @ 2020-12-27 04:01
Grandyang
阅读(2426)
推荐(0)
摘要:
On a 2 dimensional , there are 4 types of squares: represents the starting square. There is exactly one starting square. represents the ending square.
阅读全文
posted @ 2020-12-26 09:42
Grandyang
阅读(1819)
推荐(0)
摘要:
You are given the root of a binary tree with n nodes where each node in the tree has node.val coins and there are n coins total. In one move, we may c
阅读全文
posted @ 2020-12-25 13:09
Grandyang
阅读(1880)
推荐(0)
摘要:
Given an integer array , return the length of a maximum size turbulent subarray of . A subarray is turbulent if the comparison sign flips between each
阅读全文
posted @ 2020-12-24 14:07
Grandyang
阅读(1005)
推荐(2)
摘要:
Given an array of positive lengths, return the largest perimeter of a triangle with non zero area, formed from 3 of these lengths. If it is impossible
阅读全文
posted @ 2020-12-22 13:32
Grandyang
阅读(1062)
推荐(0)
摘要:
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: I
阅读全文
posted @ 2020-12-22 13:30
Grandyang
阅读(2500)
推荐(1)
摘要:
You are given an integer array . From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called odd
阅读全文
posted @ 2020-12-21 14:32
Grandyang
阅读(1433)
推荐(0)
摘要:
Given an array of integers, return the number of (contiguous, non empty) subarrays that have a sum divisible by . Example 1: Note: 1. `1 这道题给了一个数组,让返回
阅读全文
posted @ 2020-12-20 12:43
Grandyang
阅读(2101)
推荐(0)
摘要:
We have a list of on the plane. Find the closest points to the origin . (Here, the distance between two points on a plane is the Euclidean distance.)
阅读全文
posted @ 2020-12-19 16:00
Grandyang
阅读(3226)
推荐(0)
摘要:
Given two strings and , each of which represents a non negative rational number, return True if and only if they represent the same number. The string
阅读全文
posted @ 2020-12-18 15:15
Grandyang
阅读(432)
推荐(0)
摘要:
You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n val
阅读全文
posted @ 2020-12-17 15:57
Grandyang
阅读(712)
推荐(0)
摘要:
Given two positive integers and , an integer is powerful if it is equal to for some integers and . Return a list of all powerful integers that have va
阅读全文
posted @ 2020-12-16 12:39
Grandyang
阅读(633)
推荐(0)
摘要:
Given an array of integers , sort the array by performing a series of pancake flips. In one pancake flip we do the following steps: Choose an integer
阅读全文
posted @ 2020-12-15 14:50
Grandyang
阅读(1156)
推荐(0)
摘要:
Given a binary tree, we install cameras on the nodes of the tree. Each camera at a node can monitor its parent, itself, and its immediate children. Ca
阅读全文
posted @ 2020-12-14 08:54
Grandyang
阅读(1974)
推荐(1)
摘要:
Return all non negative integers of length such that the absolute difference between every two consecutive digits is . Note that every number in the a
阅读全文
posted @ 2020-12-13 07:17
Grandyang
阅读(718)
推荐(0)
摘要:
Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. For a given query word, the spell checker handle
阅读全文
posted @ 2020-12-12 15:32
Grandyang
阅读(717)
推荐(0)
摘要:
Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (row, col), its left and right c
阅读全文
posted @ 2020-12-11 15:38
Grandyang
阅读(1942)
推荐(0)
摘要:
A binary tree is univalued if every node in the tree has the same value. Return if and only if the given tree is univalued. Example 1: Example 2: Note
阅读全文
posted @ 2020-12-10 13:51
Grandyang
阅读(578)
推荐(0)
摘要:
Given a single positive integer , we will write an expression of the form where each operator , , etc. is either addition, subtraction, multiplication
阅读全文
posted @ 2020-12-09 15:56
Grandyang
阅读(701)
推荐(0)
摘要:
Given a set of points in the xy plane, determine the minimum area of any rectangle formed from these points, with sides not necessarily parallel to th
阅读全文
posted @ 2020-12-08 15:56
Grandyang
阅读(1148)
推荐(0)
摘要:
Given an array of integers, a ramp is a tuple for which `i 这道题说给了一个数组A,这里定义了一种叫做 Ramp 的范围 (i, j),满足 `i Github 同步地址: 参考资料: "LeetCode All in One 题目讲解汇总(
阅读全文
posted @ 2020-11-29 07:55
Grandyang
阅读(1091)
推荐(0)
摘要:
In a array of size , there are unique elements, and exactly one of these elements is repeated times. Return the element repeated times. Example 1: Exa
阅读全文
posted @ 2020-11-27 03:45
Grandyang
阅读(1206)
推荐(1)
摘要:
We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we
阅读全文
posted @ 2020-11-23 08:54
Grandyang
阅读(730)
推荐(0)
摘要:
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 re
阅读全文
posted @ 2020-10-31 23:56
Grandyang
阅读(1290)
推荐(1)
摘要:
Given a binary tree, determine if it is a complete binary tree. Definition of a complete binary tree from Wikipedia: In a complete binary tree every l
阅读全文
posted @ 2020-09-21 12:30
Grandyang
阅读(1904)
推荐(1)
摘要:
There are 8 prison cells in a row, and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to t
阅读全文
posted @ 2020-08-31 04:28
Grandyang
阅读(1703)
推荐(0)
摘要:
You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel suppor
阅读全文
posted @ 2020-08-17 13:51
Grandyang
阅读(1478)
推荐(0)
摘要:
We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we
阅读全文
posted @ 2020-08-07 15:28
Grandyang
阅读(1128)
推荐(0)
摘要:
Given an array of integers A with even length, return true if and only if it is possible to reorder it such that A[2 * i + 1] = 2 * A[2 * i] for every
阅读全文
posted @ 2020-07-26 13:25
Grandyang
阅读(1529)
推荐(0)
摘要:
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permu
阅读全文
posted @ 2020-07-08 15:47
Grandyang
阅读(2915)
推荐(0)
摘要:
Given a non-empty array of unique positive integers A, consider the following graph: There are A.length nodes, labelled A[0] to A[A.length - 1]; There
阅读全文
posted @ 2020-07-06 10:22
Grandyang
阅读(1753)
推荐(0)
摘要:
For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees. A binary tree X is flip e
阅读全文
posted @ 2020-07-02 15:00
Grandyang
阅读(1452)
推荐(0)
摘要:
In a deck of cards, every card has a unique integer. You can order the deck in any order you want. Initially, all the cards start face down (unreveale
阅读全文
posted @ 2020-06-22 11:51
Grandyang
阅读(1504)
推荐(0)
摘要:
Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 hour time is 00:00, and the largest is 23:59. Starting f
阅读全文
posted @ 2020-06-14 03:29
Grandyang
阅读(1707)
推荐(0)
摘要:
You have an initial power P, an initial score of 0 points, and a bag of tokens. Each token can be used at most once, has a value token[i], and has pot
阅读全文
posted @ 2020-06-11 13:06
Grandyang
阅读(1550)
推荐(1)
摘要:
On a 2D plane, we place stones at some integer coordinate points. Each coordinate point may have at most one stone. Now, a move consists of removing a
阅读全文
posted @ 2020-06-01 13:29
Grandyang
阅读(2378)
推荐(0)
摘要:
Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop o
阅读全文
posted @ 2020-05-26 03:44
Grandyang
阅读(2137)
推荐(1)
摘要:
Given an array of integers A, a move consists of choosing any , and incrementing it by . Return the least number of moves to make every value in uniqu
阅读全文
posted @ 2020-05-18 07:56
Grandyang
阅读(1530)
推荐(0)