04 2019 档案

摘要:In an array A containing only 0s and 1s, a *K-bit flip *consists of choosing a (contiguous) subarray of length K and simultaneously changing every 0 i 阅读全文
posted @ 2019-04-29 23:48 Grandyang 阅读(2143) 评论(7) 推荐(0) 编辑
摘要:A sequence is fibonacci like if: for all `i + 2 这道题给了我们一个数组,让找其中最长的斐波那契序列,既然是序列而非子数组,那么数字就不必挨着,但是顺序还是需要保持,题目中说了数组是严格递增的,其实博主认为这个条件可有可无的,反正又不能用二分搜索。关于斐 阅读全文
posted @ 2019-04-27 23:59 Grandyang 阅读(2991) 评论(0) 推荐(0) 编辑
摘要:Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2019-04-25 23:27 Grandyang 阅读(2195) 评论(0) 推荐(0) 编辑
摘要:Given two arrays and of equal size, the advantage of with respect to is the number of indices for which . Return any permutation of that maximizes its 阅读全文
posted @ 2019-04-23 22:36 Grandyang 阅读(2667) 评论(0) 推荐(0) 编辑
摘要:Starting with a positive integer , we reorder the digits in any order (including the original order) such that the leading digit is not zero. Return i 阅读全文
posted @ 2019-04-21 23:57 Grandyang 阅读(2432) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer , find and return the longest distance between two consecutive 1's in the binary representation of . If there aren't two cons 阅读全文
posted @ 2019-04-19 22:52 Grandyang 阅读(1848) 评论(1) 推荐(0) 编辑
摘要:Given a matrix , return the transpose of . The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indic 阅读全文
posted @ 2019-04-17 23:29 Grandyang 阅读(2155) 评论(0) 推荐(0) 编辑
摘要:Find the smallest prime palindrome greater than or equal to . Recall that a number is prime if it's only divisors are 1 and itself, and it is greater 阅读全文
posted @ 2019-04-15 23:04 Grandyang 阅读(2741) 评论(1) 推荐(0) 编辑
摘要:Given a binary tree rooted at , the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possible am 阅读全文
posted @ 2019-04-13 23:53 Grandyang 阅读(2968) 评论(0) 推荐(0) 编辑
摘要:We are given a binary tree (with root node ), a node, and an integer value . Return a list of the values of all nodes that have a distance from the no 阅读全文
posted @ 2019-04-10 23:18 Grandyang 阅读(7025) 评论(0) 推荐(0) 编辑
摘要:We have a two dimensional matrix where each value is or . A move consists of choosing any row or column, and toggling each value in that row or column 阅读全文
posted @ 2019-04-08 23:55 Grandyang 阅读(2281) 评论(1) 推荐(0) 编辑
摘要:At a lemonade stand, each lemonade costs . Customers are standing in a queue to buy from you, and order one at a time (in the order specified by ). Ea 阅读全文
posted @ 2019-04-06 23:45 Grandyang 阅读(1990) 评论(0) 推荐(0) 编辑
摘要:Given two strings and of lowercase letters, return if and only if we can swap two letters in so that the result equals . Example 1: Example 2: Example 阅读全文
posted @ 2019-04-04 23:33 Grandyang 阅读(2660) 评论(0) 推荐(0) 编辑
摘要:There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining c 阅读全文
posted @ 2019-04-02 22:56 Grandyang 阅读(3309) 评论(0) 推荐(2) 编辑

Fork me on GitHub