随笔分类 -  LeetCode

上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 61 下一页
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-04-06 12:41 Grandyang 阅读(21407) 评论(3) 推荐(0)
摘要:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em 阅读全文
posted @ 2016-04-05 11:21 Grandyang 阅读(3884) 评论(0) 推荐(1)
摘要:Write a SQL query to find all numbers that appear at least three times consecutively. For example, given the above Logs table, 1 is the only number th 阅读全文
posted @ 2016-04-05 10:51 Grandyang 阅读(6391) 评论(0) 推荐(0)
摘要:Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking num 阅读全文
posted @ 2016-04-04 11:20 Grandyang 阅读(14193) 评论(17) 推荐(0)
摘要:Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 阅读全文
posted @ 2016-04-04 08:22 Grandyang 阅读(27213) 评论(7) 推荐(2)
摘要:Write a SQL query to get the nth highest salary from the Employee table. For example, given the above Employee table, the nth highest salary where n = 阅读全文
posted @ 2016-04-03 05:43 Grandyang 阅读(10430) 评论(0) 推荐(1)
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the second highest salary is  阅读全文
posted @ 2016-04-03 05:00 Grandyang 阅读(11379) 评论(7) 推荐(1)
摘要:Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if 阅读全文
posted @ 2016-04-03 04:09 Grandyang 阅读(6369) 评论(0) 推荐(1)
摘要:Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文
posted @ 2016-03-31 10:57 Grandyang 阅读(17571) 评论(1) 推荐(1)
摘要:Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Note:The sum of 阅读全文
posted @ 2016-03-30 12:14 Grandyang 阅读(21312) 评论(8) 推荐(0)
摘要:Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possib 阅读全文
posted @ 2016-03-29 13:55 Grandyang 阅读(14506) 评论(5) 推荐(0)
摘要:Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the seq 阅读全文
posted @ 2016-03-28 05:55 Grandyang 阅读(12938) 评论(2) 推荐(0)
摘要:Given a pattern and a string str, find if strfollows the same pattern. Here follow means a full match, such that there is a bijection between a letter 阅读全文
posted @ 2016-03-27 15:14 Grandyang 阅读(12955) 评论(10) 推荐(1)
摘要:There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2016-03-26 14:26 Grandyang 阅读(16364) 评论(5) 推荐(0)
摘要:There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certai 阅读全文
posted @ 2016-03-25 14:30 Grandyang 阅读(18976) 评论(7) 推荐(0)
摘要:Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form 阅读全文
posted @ 2016-03-24 13:51 Grandyang 阅读(12562) 评论(0) 推荐(0)
摘要:Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha 阅读全文
posted @ 2016-03-23 13:00 Grandyang 阅读(21733) 评论(4) 推荐(1)
摘要:Given a binary search tree and a node in it, find the in-order successor of that node in the BST. The successor of a node p is the node with the small 阅读全文
posted @ 2016-03-22 13:49 Grandyang 阅读(20459) 评论(9) 推荐(0)
摘要:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2 阅读全文
posted @ 2016-03-21 03:36 Grandyang 阅读(18653) 评论(2) 推荐(0)
摘要:You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right. 阅读全文
posted @ 2016-03-20 14:14 Grandyang 阅读(23338) 评论(10) 推荐(0)

上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 61 下一页
Fork me on GitHub