
LeetCode
文章平均质量分 59
小白LeetCode路程。
繁城落叶
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode目录。
本目录只会在一个Tag完成之后更新,实时更新目录:https://github.com/jiajia0/LeetCode。按照LeetCode的Tags来区分的话,目前共有34个Tag,只列出已经解决的题,各分类中按照题目编号排序:Linked List。Solved:21/28 # Title Difficulty 2 Add Two Numbe原创 2017-11-21 18:41:33 · 651 阅读 · 0 评论 -
66. Plus One。
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element...原创 2019-01-10 21:00:43 · 376 阅读 · 0 评论 -
846. Hand of Straights。
Alice has a hand of cards, given as an array of integers.Now she wants to rearrange the cards into groups so that each group is size W, and consists of W consecutive cards.Return true if and only i...原创 2019-01-06 23:59:30 · 392 阅读 · 0 评论 -
830. Positions of Large Groups。
In a string S of lowercase letters, these letters form consecutive groups of the same character.For example, a string like S = “abbxxxxzyy” has the groups “a”, “bb”, “xxxx”, “z” and “yy”.Call a gro...原创 2019-01-05 16:31:41 · 387 阅读 · 0 评论 -
888. Fair Candy Swap。
Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of candy that Bob has.Since they are friends, they wo...原创 2019-01-04 22:33:48 · 406 阅读 · 0 评论 -
896. Monotonic Array。
An array is monotonic if it is either monotone increasing or monotone decreasing.An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for al...原创 2019-01-03 21:21:17 · 356 阅读 · 0 评论 -
876. Middle of the Linked List。
Given a non-empty, singly linked list with head node head, return a middle node of linked list.If there are two middle nodes, return the second middle node.Example 1:Input: [1,2,3,4,5]Output: N...原创 2019-01-03 20:29:12 · 371 阅读 · 0 评论 -
867. Transpose Matrix。
Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it’s main diagonal, switching the row and column indices of the matrix.Example 1:Input: [[1,2,3],...原创 2019-01-03 19:14:21 · 278 阅读 · 0 评论 -
922. Sort Array By Parity II。
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is...原创 2019-01-02 20:32:25 · 389 阅读 · 0 评论 -
832. Flipping an Image。
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For examp...原创 2019-01-01 17:57:38 · 340 阅读 · 0 评论 -
905. Sort Array By Parity。
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditio...原创 2018-12-30 21:42:43 · 376 阅读 · 0 评论 -
804. Unique Morse Code Words。
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-“, “b” maps to “-…”, “c” maps to “-.-.”, and so on.For con...原创 2018-04-30 14:45:35 · 619 阅读 · 0 评论 -
451. Sort Characters By Frequency。
Given a string, sort it in decreasing order based on the frequency of characters.Example 1: Input: “tree” Output: “eert” Explanation: ‘e’ appears twice while ‘r’ and ‘t’ both appea原创 2018-02-25 19:18:56 · 413 阅读 · 0 评论 -
748. Shortest Completing Word。
Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given string licensePlateHere, for letters we ign原创 2018-02-23 00:02:41 · 719 阅读 · 0 评论 -
739. Daily Temperatures。
Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this i原创 2018-02-22 23:16:08 · 968 阅读 · 0 评论 -
136. Single Number。
Given an array of integers, every element appears twice except for one. Find that single one.原文:https://leetcode.com/problems/single-number/description/在一写数字中,有一个数字只出现了一次,其余的都出现了两次,找出出现一次的数字。首先可以利用额外的辅原创 2018-02-21 20:33:48 · 409 阅读 · 0 评论 -
463. Island Perimeter。
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 horizontally/vertically (not diagonally). The grid is completely s原创 2018-02-21 13:02:51 · 378 阅读 · 0 评论 -
575. Distribute Candies。
Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these原创 2018-02-21 10:14:20 · 467 阅读 · 0 评论 -
500. Keyboard Row。
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.Example 1: Input: [“Hello”, “Alaska”, “Dad”, “Peace”]原创 2018-02-20 22:05:45 · 530 阅读 · 0 评论 -
771. Jewels and Stones。
You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the ston原创 2018-02-20 17:08:15 · 625 阅读 · 0 评论 -
216. Combination Sum III。
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1: Input: k ...原创 2018-02-20 14:34:55 · 411 阅读 · 0 评论 -
769. Max Chunks To Make Sorted。
Given an array arr that is a permutation of [0, 1, …, arr.length - 1], we split the array into some number of “chunks” (partitions), and individually sort each chunk. After concatenating them, the re...原创 2018-02-14 12:06:43 · 617 阅读 · 0 评论 -
714. Best Time to Buy and Sell Stock with Transaction Fee。
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many tra原创 2018-02-12 22:50:26 · 793 阅读 · 0 评论 -
121. Best Time to Buy and Sell Stock。
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi原创 2018-02-09 23:12:44 · 390 阅读 · 0 评论 -
661. Image Smoother。
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrou原创 2018-01-27 23:43:02 · 548 阅读 · 0 评论 -
122. Best Time to Buy and Sell Stock II。
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and原创 2018-01-26 23:20:32 · 508 阅读 · 0 评论 -
287. Find the Duplicate Number。
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fin原创 2018-01-26 00:07:04 · 538 阅读 · 0 评论 -
766. Toeplitz Matrix。
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz.Example 1: Input: matrix = [[1,2原创 2018-01-25 00:06:21 · 1132 阅读 · 0 评论 -
674. Longest Continuous Increasing Subsequence。
Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous increasi原创 2018-01-09 20:30:17 · 534 阅读 · 0 评论 -
565. Array Nesting。
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.Suppose the原创 2018-01-10 15:35:53 · 444 阅读 · 0 评论 -
268. Missing Number。
Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1 Input: [3,0,1] Output: 2Example 2 Input: [9,6,4,2,3,5,7,0,1] Outp原创 2018-01-08 21:16:20 · 472 阅读 · 0 评论 -
628. Maximum Product of Three Numbers。
Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1: Input: [1,2,3] Output: 6Example 2: Input: [1,2,3,4] Output: 24给定一个数组,找出三个数产生的乘积原创 2018-01-08 20:11:59 · 466 阅读 · 0 评论 -
747. Largest Number At Least Twice of Others。
In a given integer array nums, there is always exactly one largest element.Find whether the largest element in the array is at least twice as much as every other number in the array.If it is, return th原创 2018-01-07 21:12:12 · 1299 阅读 · 0 评论 -
217. Contains Duplicate。
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is原创 2018-01-07 20:35:17 · 388 阅读 · 0 评论 -
167. Two Sum II - Input array is sorted。
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers suc原创 2018-01-06 20:45:58 · 509 阅读 · 0 评论 -
169. Majority Element。
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always原创 2018-01-06 14:41:57 · 479 阅读 · 0 评论 -
238. Product of Array Except Self。
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).原创 2018-01-05 16:08:55 · 441 阅读 · 0 评论 -
495. Teemo Attacking。
In LOL 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 ascending time series towards Ashe and the poisoning time原创 2017-12-19 19:36:47 · 678 阅读 · 0 评论 -
667. Beautiful Arrangement II。
Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1, a2, a3, … , an],原创 2017-12-14 19:32:28 · 698 阅读 · 0 评论 -
283. Move Zeroes。
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, given nums = [0, 1, 0, 3, 12], after calling your funct原创 2017-12-09 18:25:23 · 472 阅读 · 0 评论