intersting
你看见我的代码了么
愿世界没有bug
展开
-
[leetcode]659. Split Array into Consecutive Subsequences
[leetcode]659. Split Array into Consecutive SubsequencesAnalysisHappy girls day—— [每天刷题并不难0.0]You are given an integer array sorted in ascending order (may contain duplicates), you need to spli...原创 2019-03-07 15:06:11 · 293 阅读 · 0 评论 -
[leetcode]764. Largest Plus Sign
[leetcode]764. Largest Plus SignAnalysis2019年还没见过太阳,等一个晴天!!!—— [每天刷题并不难0.0]In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are ...原创 2019-01-11 10:22:26 · 262 阅读 · 0 评论 -
[leetcode]319. Bulb Switcher
[leetcode]319. Bulb SwitcherAnalysis今天被微博上的孙艺兴bot笑死,哈哈哈哈哈—— [每天刷题并不难0.0]There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the t...原创 2018-12-19 11:03:23 · 108 阅读 · 0 评论 -
[leetcode]470. Implement Rand10() Using Rand7()
[leetcode]470. Implement Rand10() Using Rand7()Analysis今天被微博上的孙艺兴bot笑死,哈哈哈哈哈—— [每天刷题并不难0.0]Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function ...原创 2018-12-19 10:48:51 · 119 阅读 · 0 评论 -
[leetcode]652. Find Duplicate Subtrees
[leetcode]652. Find Duplicate SubtreesAnalysis今天开心呀,明天放假也开心呀—— [每天刷题并不难0.0]Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the r...原创 2018-12-29 11:36:18 · 140 阅读 · 0 评论 -
[leetcode]309. Best Time to Buy and Sell Stock with Cooldown
[leetcode]309. Best Time to Buy and Sell Stock with CooldownAnalysis直男真可怕—— [每天刷题并不难0.0]Say you have an array for which the ith element is the price of a given stock on day i.Design an algorit...原创 2018-12-24 11:12:06 · 84 阅读 · 0 评论 -
[leetcode]394. Decode String
[leetcode]394. Decode StringAnalysis直男真可怕—— [每天刷题并不难0.0]Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square ...原创 2018-12-24 10:00:23 · 81 阅读 · 0 评论 -
[leetcode]386. Lexicographical Numbers
[leetcode]386. Lexicographical NumbersAnalysisnormal day—— [每天刷题并不难0.0]Given an integer n, return 1 - n in lexicographical order.For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9]....原创 2018-12-18 10:25:45 · 101 阅读 · 0 评论 -
[leetcode]59. Spiral Matrix II
[leetcode]59. Spiral Matrix IIAnalysisintern intern intern—— [每天刷题并不难0.0]Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.Implementclass...原创 2018-12-17 10:13:04 · 135 阅读 · 0 评论 -
[leetcode]875. Koko Eating Bananas
[leetcode]875. Koko Eating BananasAnalysis直男真可怕—— [每天刷题并不难0.0]Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come b...原创 2018-12-21 11:14:20 · 138 阅读 · 0 评论 -
[leetcode]873. Length of Longest Fibonacci Subsequence
[leetcode]873. Length of Longest Fibonacci SubsequenceAnalysis中午吃啥—— [每天刷题并不难0.0]A sequence X_1, X_2, …, X_n is fibonacci-like if:n >= 3X_i + X_{i+1} = X_{i+2} for all i + 2 <= nGiven ...原创 2018-12-20 11:49:10 · 130 阅读 · 0 评论 -
[leetcode]752. Open the Lock
[leetcode]752. Open the LockAnalysis2019要开心鸭—— [每天刷题并不难0.0]You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’. The...原创 2019-01-02 10:00:21 · 124 阅读 · 0 评论 -
[leetcode]380. Insert Delete GetRandom O(1)
[leetcode]380. Insert Delete GetRandom O(1)Analysis出太阳啦~—— [每天刷题并不难0.0]Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to ...原创 2019-01-17 10:20:36 · 160 阅读 · 0 评论 -
[leetcode]838. Push Dominoes
[leetcode]838. Push DominoesAnalysis2019要开心鸭—— [每天刷题并不难0.0]here are N dominoes in a line, and we place each domino vertically upright.In the beginning, we simultaneously push some of the domin...原创 2019-01-03 09:43:21 · 253 阅读 · 0 评论 -
[leetcode]962. Maximum Width Ramp
[leetcode]962. Maximum Width RampAnalysisraining outside…—— [每天刷题并不难0.0]Given an array A of integers, a ramp is a tuple (i, j) for which i < j and A[i] <= A[j]. The width of such a ramp ...原创 2019-03-02 10:08:21 · 144 阅读 · 0 评论 -
[leetcode]313. Super Ugly Number
[leetcode]313. Super Ugly NumberAnalysismissing—— [每天刷题并不难0.0]Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given...原创 2019-02-26 11:25:06 · 135 阅读 · 0 评论 -
[leetcode]974. Subarray Sums Divisible by K
[leetcode]974. Subarray Sums Divisible by KAnalysis努力工作哇—— [每天刷题并不难0.0]Given an array A of integers, return the number of (contiguous, non-empty) subarrays that have a sum divisible by K.Expl...原创 2019-02-23 10:37:50 · 195 阅读 · 0 评论 -
[leetcode]114. Flatten Binary Tree to Linked List
[leetcode]114. Flatten Binary Tree to Linked ListAnalysis努力工作哇—— [每天刷题并不难0.0]Given a binary tree, flatten it to a linked list in-place.Explanation:参考:http://www.cnblogs.com/grandyang/p/42938...原创 2019-02-23 09:50:13 · 126 阅读 · 0 评论 -
[leetcode]792. Number of Matching Subsequences
[leetcode]792. Number of Matching SubsequencesAnalysis明天就是除夕啦—— [每天刷题并不难0.0]Given string S and a dictionary of words words, find the number of words[i] that is a subsequence of S.Explanation:...原创 2019-02-03 14:12:59 · 151 阅读 · 0 评论 -
[leetcode]698. Partition to K Equal Sum Subsets
[leetcode]698. Partition to K Equal Sum SubsetsAnalysis终于抽到敬业福啦 哈哈哈—— [每天刷题并不难0.0]Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into ...原创 2019-02-01 11:25:19 · 196 阅读 · 0 评论 -
[leetcode]560. Subarray Sum Equals K
[leetcode]560. Subarray Sum Equals KAnalysisummm 心情复杂—— [每天刷题并不难0.0]Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k...原创 2019-01-22 11:01:43 · 106 阅读 · 0 评论 -
[leetcode]731. My Calendar II
[leetcode]731. My Calendar IIAnalysis出太阳啦~—— [每天刷题并不难0.0]Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking.Your...原创 2019-01-16 10:40:41 · 201 阅读 · 0 评论 -
[leetcode]971. Flip Binary Tree To Match Preorder Traversal
[leetcode]971. Flip Binary Tree To Match Preorder TraversalAnalysis昨天和今天天气都很好鸭~嘻嘻—— [每天刷题并不难0.0]Given a binary tree with N nodes, each node has a different value from {1, …, N}.A node in this ...原创 2019-01-18 09:52:48 · 203 阅读 · 0 评论 -
[leetcode]525. Contiguous Array
[leetcode]525. Contiguous ArrayAnalysis不想努力了,等一个富婆—— [每天刷题并不难0.0]Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.Explanation:把数组里的0都变成-1,然...原创 2019-01-03 10:38:57 · 93 阅读 · 0 评论 -
[leetcode]516. Longest Palindromic Subsequence
[leetcode]516. Longest Palindromic SubsequenceAnalysis完了完了 真的要找不到工作了!!!!!苍了天了!!!—— [每天刷题并不难0.0]Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the ...原创 2018-12-06 11:47:47 · 83 阅读 · 0 评论 -
[leetcode]494. Target Sum
[leetcode]494. Target SumAnalysis完了完了 真的要找不到工作了!!!!!苍了天了!!!—— [每天刷题并不难0.0]You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each...原创 2018-12-06 10:04:38 · 169 阅读 · 0 评论 -
[leetcode]416. Partition Equal Subset Sum
[leetcode]416. Partition Equal Subset SumAnalysis完了完了 真的要找不到工作了!!!!!苍了天了!!!—— [每天刷题并不难0.0]Given a non-empty array containing only positive integers, find if the array can be partitioned into tw...原创 2018-12-06 09:53:18 · 113 阅读 · 0 评论 -
[leetcode]648. Replace Words
[leetcode]648. Replace WordsAnalysis ummmmmmm—— [ummmm~]In English, we have a concept called root, which can be followed by some other words to form another longer word - let’s call this w...原创 2018-09-14 17:23:44 · 224 阅读 · 0 评论 -
[leetcode]382. Linked List Random Node
[leetcode]382. Linked List Random NodeAnalysis等国庆!!!!!—— [嘻嘻~]Given a singly linked list, return a random node’s value from the linked list. Each node must have the same probability of being ch...原创 2018-09-25 14:18:51 · 155 阅读 · 0 评论 -
[leetcode]454. 4Sum II
[leetcode]454. 4Sum IIAnalysis等国庆!!!!!—— [嘻嘻~]Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make ...原创 2018-09-25 11:04:39 · 96 阅读 · 0 评论 -
[leetcode]15. 3Sum
[leetcode]15. 3SumAnalysis中秋节了,中午要去吃海底捞—— [嘻嘻~]Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives t...原创 2018-09-24 09:29:18 · 74 阅读 · 0 评论 -
[leetcode]46. Permutations
[leetcode]46. PermutationsAnalysis ummmmmmmmmmmmmmmmmmmmmmmmm~—— [ummmm~]Given a collection of distinct integers, return all possible permutations. 求全排列的题,这篇文章里面讲的很清楚,可以参考一下:https://blog....原创 2018-09-10 16:21:48 · 93 阅读 · 0 评论 -
[leetcode]238. Product of Array Except Self
[leetcode]238. Product of Array Except SelfAnalysis new plan~—— [好好养生啊!!]Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the produ...原创 2018-09-06 20:29:09 · 88 阅读 · 0 评论 -
22. Generate Parentheses
22. Generate ParenthesesAnalysis 中午吃啥~—— [ummmm~]Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 递归实现~Implementclass Solution {...原创 2018-09-09 16:40:25 · 74 阅读 · 0 评论 -
565. Array Nesting
565. Array NestingAnalysis 中午吃啥~—— [ummmm~]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]],...原创 2018-09-09 10:58:15 · 113 阅读 · 0 评论 -
[leetcode]260. Single Number III
[leetcode]260. Single Number IIIAnalysis 心态奶茶妹妹~—— [马云爸爸恐成最大赢家 哈哈哈]Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly ...原创 2018-09-03 12:02:03 · 103 阅读 · 0 评论 -
[leetcode]667. Beautiful Arrangement II
[leetcode]667. Beautiful Arrangement IIAnalysis ummmmm~—— [ummmm]Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n a...原创 2018-09-07 19:54:46 · 106 阅读 · 0 评论 -
[leetcode]451. Sort Characters By Frequency
[leetcode]451. Sort Characters By FrequencyAnalysis 虚惊一场~—— [好好养生!!]Given a string, sort it in decreasing order based on the frequency of characters. 先吧字符以及其出现次数存入hash表中,然后再把hash表中的字符和出现次...原创 2018-09-04 20:57:16 · 144 阅读 · 0 评论 -
[leetcode]769. Max Chunks To Make Sorted
[leetcode]769. Max Chunks To Make SortedAnalysis ummmmmmm—— [ummmm~]Given an array arr that is a permutation of [0, 1, …, arr.length - 1], we split the array into some number of “chunks” (...原创 2018-09-14 19:33:26 · 127 阅读 · 0 评论 -
[leetcode]503. Next Greater Element II
[leetcode]503. Next Greater Element IIAnalysis电脑坏了—— [心塞!!]Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for eve...原创 2018-09-21 21:06:25 · 81 阅读 · 0 评论