随笔分类 -  LeetCode

上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 61 下一页
摘要:Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The 阅读全文
posted @ 2017-02-25 21:12 Grandyang 阅读(11148) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2017-02-23 23:45 Grandyang 阅读(12793) 评论(8) 推荐(2) 编辑
摘要:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Examp 阅读全文
posted @ 2017-02-20 21:55 Grandyang 阅读(6727) 评论(2) 推荐(0) 编辑
摘要:Given an integer, return its base 7 string representation. Example 1: Example 2: Note: The input will be in range of [-1e7, 1e7]. 这道题给了我们一个数,让我们转为七进制的 阅读全文
posted @ 2017-02-20 00:09 Grandyang 阅读(6903) 评论(2) 推荐(0) 编辑
摘要:You need to find the largest value in each row of a binary tree. Example: 这道题让我们找二叉树每行的最大的结点值,那么实际上最直接的方法就是用层序遍历,然后在每一层中找到最大值,加入结果res中即可,参见代码如下: 解法一: 阅读全文
posted @ 2017-02-19 23:29 Grandyang 阅读(4922) 评论(0) 推荐(0) 编辑
摘要:Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Note: 阅读全文
posted @ 2017-02-18 23:13 Grandyang 阅读(13366) 评论(1) 推荐(0) 编辑
摘要:Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Example 2: Note: You may assume the tree (i.e., the given root no 阅读全文
posted @ 2017-02-16 12:28 Grandyang 阅读(6998) 评论(4) 推荐(0) 编辑
摘要:You are given two integer arrays nums1 and nums2 both of unique elements, where nums1 is a subset of nums2. Find all the next greater numbers for nums 阅读全文
posted @ 2017-02-15 03:15 Grandyang 阅读(17009) 评论(5) 推荐(1) 编辑
摘要:In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascend 阅读全文
posted @ 2017-02-14 22:01 Grandyang 阅读(4798) 评论(0) 推荐(0) 编辑
摘要:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose o 阅读全文
posted @ 2017-02-13 23:21 Grandyang 阅读(19720) 评论(8) 推荐(1) 编辑
摘要:For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now i 阅读全文
posted @ 2017-02-11 23:57 Grandyang 阅读(3581) 评论(6) 推荐(0) 编辑
摘要: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 su 阅读全文
posted @ 2017-02-10 22:11 Grandyang 阅读(8987) 评论(5) 推荐(2) 编辑
摘要: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 roll 阅读全文
posted @ 2017-02-09 11:57 Grandyang 阅读(26608) 评论(10) 推荐(2) 编辑
摘要:Given a binary array, find the maximum number of consecutive 1s in this array if you can flip at most one 0. Example 1: Input: [1,0,1,1,0] Output: 4 E 阅读全文
posted @ 2017-02-07 22:15 Grandyang 阅读(10994) 评论(2) 推荐(2) 编辑
摘要:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t 阅读全文
posted @ 2017-02-06 11:25 Grandyang 阅读(12548) 评论(4) 推荐(0) 编辑
摘要:By now, you are given a secret signature consisting of character 'D' and 'I'. 'D' represents a decreasing relationship between two numbers, 'I' repres 阅读全文
posted @ 2017-02-05 00:07 Grandyang 阅读(7342) 评论(4) 推荐(1) 编辑
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di 阅读全文
posted @ 2017-02-02 10:00 Grandyang 阅读(8297) 评论(0) 推荐(0) 编辑
摘要:A magical string S consists of only '1' and '2' and obeys the following rules: The string S is magical because concatenating the number of contiguous 阅读全文
posted @ 2017-01-15 03:50 Grandyang 阅读(7947) 评论(2) 推荐(0) 编辑
摘要:Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical charac 阅读全文
posted @ 2017-01-12 14:02 Grandyang 阅读(6449) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given inte 阅读全文
posted @ 2017-01-11 23:55 Grandyang 阅读(8819) 评论(1) 推荐(0) 编辑

上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 61 下一页
Fork me on GitHub