03 2017 档案

摘要:题目: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", 阅读全文
posted @ 2017-03-31 06:50 panini 阅读(297) 评论(0) 推荐(0)
摘要:题目: Given an integer, return its base 7 string representation. Example 1: Example 2: Note: The input will be in range of [-1e7, 1e7]. 链接:https://leetc 阅读全文
posted @ 2017-03-31 05:50 panini 阅读(204) 评论(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 de 阅读全文
posted @ 2017-03-31 04:27 panini 阅读(566) 评论(0) 推荐(0)
摘要:题目: 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. E 阅读全文
posted @ 2017-03-30 11:30 panini 阅读(239) 评论(0) 推荐(0)
摘要:题目; You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nu 阅读全文
posted @ 2017-03-30 10:26 panini 阅读(192) 评论(0) 推荐(0)
摘要:题目: 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 n 阅读全文
posted @ 2017-03-30 00:53 panini 阅读(167) 评论(0) 推荐(0)
摘要:题目: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The len 阅读全文
posted @ 2017-03-29 11:09 panini 阅读(175) 评论(0) 推荐(0)
摘要:题目: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: 阅读全文
posted @ 2017-03-29 06:18 panini 阅读(209) 评论(0) 推荐(0)
摘要:题目: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are giv 阅读全文
posted @ 2017-03-29 02:07 panini 阅读(292) 评论(0) 推荐(0)
摘要:题目: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontall 阅读全文
posted @ 2017-03-28 03:07 panini 阅读(130) 评论(0) 推荐(0)
摘要:题目: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, ca 阅读全文
posted @ 2017-03-28 02:10 panini 阅读(172) 评论(0) 推荐(0)
摘要:题目: Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You m 阅读全文
posted @ 2017-03-27 10:29 panini 阅读(198) 评论(0) 推荐(0)
摘要:题目: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has 阅读全文
posted @ 2017-03-27 08:03 panini 阅读(189) 评论(0) 推荐(0)
摘要:题目: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementin 阅读全文
posted @ 2017-03-27 07:38 panini 阅读(169) 评论(0) 推荐(0)
摘要:题目: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, 阅读全文
posted @ 2017-03-26 11:58 panini 阅读(141) 评论(0) 推荐(0)
摘要:题目: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equ 阅读全文
posted @ 2017-03-26 10:36 panini 阅读(218) 评论(0) 推荐(0)
摘要:题目: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total nu 阅读全文
posted @ 2017-03-26 04:25 panini 阅读(167) 评论(0) 推荐(0)
摘要:题目: Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and 阅读全文
posted @ 2017-03-26 04:08 panini 阅读(250) 评论(0) 推荐(0)
摘要:题目: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not ne 阅读全文
posted @ 2017-03-26 01:37 panini 阅读(237) 评论(0) 推荐(0)
摘要:题目: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the str 阅读全文
posted @ 2017-03-26 00:46 panini 阅读(165) 评论(0) 推荐(0)
摘要:题目: Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column rea 阅读全文
posted @ 2017-03-26 00:22 panini 阅读(133) 评论(0) 推荐(0)
摘要:题目: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 链接:https://leetcode.com/problems/add-s 阅读全文
posted @ 2017-03-25 06:06 panini 阅读(137) 评论(0) 推荐(0)
摘要:题目: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time comp 阅读全文
posted @ 2017-03-25 02:49 panini 阅读(116) 评论(0) 推荐(0)
摘要:题目: Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the n 阅读全文
posted @ 2017-03-24 10:54 panini 阅读(174) 评论(0) 推荐(0)
摘要:题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. 阅读全文
posted @ 2017-03-24 10:15 panini 阅读(147) 评论(0) 推荐(0)
摘要:题目: Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as "word" contai 阅读全文
posted @ 2017-03-24 07:01 panini 阅读(207) 评论(0) 推荐(0)
摘要:题目: Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 阅读全文
posted @ 2017-03-24 06:05 panini 阅读(173) 评论(0) 推荐(0)
摘要:题目: Find the sum of all left leaves in a given binary tree. Example: 链接:https://leetcode.com/problems/sum-of-left-leaves/#/description 3/22/2017 perfo 阅读全文
posted @ 2017-03-24 05:15 panini 阅读(86) 评论(0) 推荐(0)
摘要:题目: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represe 阅读全文
posted @ 2017-03-24 04:46 panini 阅读(172) 评论(0) 推荐(0)
摘要:题目: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 3 阅读全文
posted @ 2017-03-24 03:20 panini 阅读(253) 评论(0) 推荐(0)
摘要:题目: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter 阅读全文
posted @ 2017-03-21 03:45 panini 阅读(139) 评论(0) 推荐(0)
摘要:题目: Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: Note: You may assume 阅读全文
posted @ 2017-03-21 01:23 panini 阅读(156) 评论(0) 推荐(0)
摘要:题目: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the 阅读全文
posted @ 2017-03-20 23:06 panini 阅读(218) 评论(0) 推荐(0)
摘要:题目: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess 阅读全文
posted @ 2017-03-18 01:48 panini 阅读(132) 评论(0) 推荐(0)
摘要:题目: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. 链接: https 阅读全文
posted @ 2017-03-15 05:09 panini 阅读(134) 评论(0) 推荐(0)
摘要:题目: Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library fun 阅读全文
posted @ 2017-03-13 10:35 panini 阅读(265) 评论(0) 推荐(0)
摘要:题目: Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed 阅读全文
posted @ 2017-03-13 07:04 panini 阅读(153) 评论(0) 推荐(0)
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each el 阅读全文
posted @ 2017-03-13 06:30 panini 阅读(153) 评论(0) 推荐(0)
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each eleme 阅读全文
posted @ 2017-03-13 04:32 panini 阅读(121) 评论(0) 推荐(0)
摘要:题目: Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, 链接: https://leetcod 阅读全文
posted @ 2017-03-13 04:09 panini 阅读(147) 评论(0) 推荐(0)
摘要:题目: Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Give 阅读全文
posted @ 2017-03-13 03:20 panini 阅读(165) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 链接:https://leetcode.com/prob 阅读全文
posted @ 2017-03-09 02:13 panini 阅读(129) 评论(0) 推荐(0)
摘要:题目 Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return 阅读全文
posted @ 2017-03-09 01:58 panini 阅读(133) 评论(0) 推荐(0)
摘要:题目: 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 阅读全文
posted @ 2017-03-09 01:32 panini 阅读(193) 评论(0) 推荐(0)
摘要:题目: Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 链接: https 阅读全文
posted @ 2017-03-08 07:05 panini 阅读(112) 评论(0) 推荐(0)
摘要:题目: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 链接: http://leetcode.com/probl 阅读全文
posted @ 2017-03-08 06:39 panini 阅读(130) 评论(0) 推荐(0)
摘要:题目: You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend tak 阅读全文
posted @ 2017-03-08 06:15 panini 阅读(143) 评论(0) 推荐(0)
摘要:题目: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 阅读全文
posted @ 2017-03-08 03:54 panini 阅读(106) 评论(0) 推荐(0)
摘要:题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a l 阅读全文
posted @ 2017-03-08 03:22 panini 阅读(148) 评论(0) 推荐(0)
摘要:题目: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, 阅读全文
posted @ 2017-03-08 02:57 panini 阅读(135) 评论(0) 推荐(0)
摘要:题目: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quali 阅读全文
posted @ 2017-03-07 06:33 panini 阅读(123) 评论(0) 推荐(0)
摘要:题目: There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adjac 阅读全文
posted @ 2017-03-06 07:21 panini 阅读(217) 评论(0) 推荐(0)
摘要:题目: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a fl 阅读全文
posted @ 2017-03-06 07:01 panini 阅读(176) 评论(0) 推荐(0)
摘要:题目: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 阅读全文
posted @ 2017-03-06 06:20 panini 阅读(121) 评论(0) 推荐(0)
摘要:题目: Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True, "carerac" -> True. H 阅读全文
posted @ 2017-03-06 06:14 panini 阅读(142) 评论(0) 推荐(0)
摘要:题目: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For 阅读全文
posted @ 2017-03-06 06:01 panini 阅读(85) 评论(0) 推荐(0)
摘要:题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l 阅读全文
posted @ 2017-03-05 12:12 panini 阅读(122) 评论(0) 推荐(0)
摘要:题目: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: 链接: http://leetcode. 阅读全文
posted @ 2017-03-05 11:53 panini 阅读(138) 评论(0) 推荐(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 ce 阅读全文
posted @ 2017-03-05 09:24 panini 阅读(195) 评论(0) 推荐(0)
摘要:题目: Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all 阅读全文
posted @ 2017-03-05 08:57 panini 阅读(139) 评论(0) 推荐(0)
摘要:题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a numb 阅读全文
posted @ 2017-03-03 07:41 panini 阅读(169) 评论(0) 推荐(0)
摘要:题目: Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example,Assume that wor 阅读全文
posted @ 2017-03-03 07:17 panini 阅读(133) 评论(0) 推荐(0)
摘要:题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", 阅读全文
posted @ 2017-03-03 06:58 panini 阅读(134) 评论(0) 推荐(0)
摘要:题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 阅读全文
posted @ 2017-03-03 05:54 panini 阅读(112) 评论(0) 推荐(0)
摘要:题目: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikip 阅读全文
posted @ 2017-03-03 04:52 panini 阅读(159) 评论(0) 推荐(0)
摘要:题目: Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 链接: http://leetcode.com/proble 阅读全文
posted @ 2017-03-01 06:01 panini 阅读(171) 评论(0) 推荐(0)
摘要:题目: Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in f 阅读全文
posted @ 2017-03-01 05:28 panini 阅读(134) 评论(0) 推荐(0)
摘要:题目: Given an integer, write a function to determine if it is a power of two. 链接: http://leetcode.com/problems/power-of-two/ 2/28/2017 看别人的。看来要注意各种比特运算 阅读全文
posted @ 2017-03-01 04:36 panini 阅读(101) 评论(0) 推荐(0)
摘要:题目: Invert a binary tree. to Trivia:This problem was inspired by this original tweet by Max Howell: 链接: http://leetcode.com/problems/invert-binary-tre 阅读全文
posted @ 2017-03-01 04:26 panini 阅读(122) 评论(0) 推荐(0)