随笔分类 - LeetCode
摘要:Given a number , return a string consisting of s and s that represents its value in base (negative two). The returned string must have no leading zero
阅读全文
摘要:Given a binary string (a string consisting only of '0' and '1's) and a positive integer , return true if and only if for every integer X from 1 to N,
阅读全文
摘要:Given a positive integer , you need to find the length of the smallest positive integer such that is divisible by , and only contains the digit . Retu
阅读全文
摘要:Given an array of positive integers, represents the value of the th sightseeing spot, and two sightseeing spots and have distance between them. The sc
阅读全文
摘要:Given an array of integers , return if we can partition the array into three non empty parts with equal sums. Formally, we can partition the array if
阅读全文
摘要:Given a positive integer , return the number of positive integers less than or equal to that have at least 1 repeated digit. Example 1: Input: 20 Outp
阅读全文
摘要:A conveyor belt has packages that must be shipped from one port to another within D days. The ith package on the conveyor belt has a weight of weights
阅读全文
摘要:You are given a list of songs where the ith song has a duration of seconds. Return the number of pairs of songs for which their total duration in seco
阅读全文
摘要:Every non negative integer has a binary representation. For example, can be represented as in binary, as in binary, and so on. Note that except for ,
阅读全文
摘要:Return the root node of a binary search tree that matches the given traversal. (Recall that a binary search tree is a binary tree where for every node
阅读全文
摘要:In a row of dominoes, and represent the top and bottom halves of the domino. (A domino is a tile with two numbers from 1 to 6 one on each half of the
阅读全文
摘要:Normally, the factorial of a positive integer is the product of all positive integers less than or equal to . For example, . We instead make a clumsy
阅读全文
摘要:Given an array of integers, we must modify the array in the following way: we choose an and replace with , and we repeat this process times in total.
阅读全文
摘要:Given an array of 0s and 1s, we may change up to values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. Exa
阅读全文
摘要:Given a string , determine if it is valid. A string is valid if, starting with an empty string , you can transform into after performing the following
阅读全文
摘要:Given an array of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including dup
阅读全文
摘要:You are given a grid of size N x N, and each cell of this grid has a lamp that is initially turned off. You are also given an array of lamp positions
阅读全文
摘要:On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, and black pawns. These are given as characters 'R', '
阅读全文
摘要:We are given the node of a maximum tree: a tree where every node has a value greater than any other value in its subtree. Just as in the "previous pro
阅读全文
摘要:In a town, there are people labelled from to . There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: 1
阅读全文