01 2017 档案
摘要:原题链接在这里:https://leetcode.com/problems/number-of-boomerangs/ 题目: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple o
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/max-consecutive-ones-ii/ 题目: Given a binary array, find the maximum number of consecutive 1s in this array if yo
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/max-consecutive-ones/ 题目: Given a binary array, find the maximum number of consecutive 1s in this array. Example
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/valid-perfect-square/ 题目: Given a positive integer num, write a function which returns True if num is a perfect
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/guess-number-higher-or-lower-ii/ 题目: We are playing the Guess Game. The game is as follows: I pick a number from
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/guess-number-higher-or-lower/ 题目: We are playing the Guess Game. The game is as follows: I pick a number from 1
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/word-pattern-ii/ 题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/arranging-coins/ 题目: You have a total of n coins that you want to form in a staircase shape, where every k-th ro
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/valid-word-square/ 题目: Given a sequence of words, check whether it forms a valid word square. A sequence of word
阅读全文
摘要:什么时候使用DP: 动态规划题目的基本思路:
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/repeated-substring-pattern/ 题目: Given a non-empty string check if it can be constructed by taking a substring of
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/number-of-segments-in-a-string/ 题目: Count the number of segments in a string, where a segment is defined to be a
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/path-sum-iii/ 题目: You are given a binary tree in which each node contains an integer value. Find the number of p
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/assign-cookies/ 题目: Assume you are an awesome parent and want to give your children some cookies. But, you shoul
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/strobogrammatic-number-iii/ 题目: A strobogrammatic number is a number that looks the same when rotated 180 degree
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/integer-replacement/ 题目: Given a positive integer n and you can do operations as follow: What is the minimum num
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/convert-a-number-to-hexadecimal/ 题目: Given an integer, write an algorithm to convert it to hexadecimal. For nega
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/number-complement/ 题目: Given a positive integer, output its complement number. The complement strategy is to fli
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/binary-watch/ 题目: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the b
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/majority-element-ii/ 题目: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/anagrams/ 题目: Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/longest-palindrome/ 题目: Given a string which consists of lowercase or uppercase letters, find the length of the
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/ransom-note/ 题目: Given an arbitrary ransom note string and another string containing letters from all the magazi
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/ 题目: Given a non-empty integer array, find the minimum number of moves
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements/ 题目: Given a non-empty integer array of size n, find the minimum number of
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays-ii/ 题目: Given two arrays, write a function to compute their intersection. Example:Giv
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays/ 题目: Given two arrays, write a function to compute their intersection. Example:Given
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/first-unique-character-in-a-string/ 题目: Given a string, find the first non-repeating character in it and return
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/sum-of-left-leaves/ 题目: Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 The
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/remove-element/ 题目: Given an array and a value, remove all instances of that value in place and return the new l
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/counting-bits/ 题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calcula
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/total-hamming-distance/ 题目: The Hamming distance between two integers is the number of positions at which the co
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/hamming-distance/ 题目: The Hamming distance between two integers is the number of positions at which the correspo
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/find-all-duplicates-in-an-array/ 题目: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ 题目: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array),
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/find-the-difference/ 题目: Given two strings s and t which consist of only lowercase letters. String t is generate
阅读全文