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",
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目; 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1:
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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,
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, 链接: https://leetcod
阅读全文
摘要:题目: 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
阅读全文
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 链接:https://leetcode.com/prob
阅读全文
摘要:题目 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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,
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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,
阅读全文
摘要:题目: Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True, "carerac" -> True. H
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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.
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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",
阅读全文
摘要:题目: 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 ->
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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 看别人的。看来要注意各种比特运算
阅读全文
摘要:题目: Invert a binary tree. to Trivia:This problem was inspired by this original tweet by Max Howell: 链接: http://leetcode.com/problems/invert-binary-tre
阅读全文
浙公网安备 33010602011771号