
leetcode
feifeiiong
这个作者很懒,什么都没留下…
展开
-
leetcode 713. Subarray Product Less Than K & leetcode 467. Unique Substrings in Wraparound String
写在前面两道类似的题目,解法不一样(哭笑不得.jpg),一道用slidingwindow解,一道DP。713. Subarray Product Less Than K题目描述Your are given an array of positive integers nums.Count and print the number of (contiguous) subar...原创 2018-03-02 21:30:46 · 469 阅读 · 0 评论 -
leetcode 236. Lowest Common Ancestor of a Binary Tree
leetcode 236原创 2017-09-07 15:27:14 · 332 阅读 · 0 评论 -
leetcode 229. Majority Element II
leetcode 229 Majority Element II原创 2017-09-22 21:10:18 · 304 阅读 · 0 评论 -
leetcode 667. Beautiful Arrangement II
leetcode 667. Beautiful Arrangement II原创 2017-08-28 19:37:33 · 2404 阅读 · 0 评论 -
leetcode 34. Search for a Range (binary search std::lower_bound)
leetcode 34. search for a range原创 2017-08-24 11:45:10 · 325 阅读 · 0 评论 -
leetcode 480. Sliding Window Median
leetcode 480. Sliding Widow Median原创 2017-08-22 20:24:34 · 870 阅读 · 0 评论 -
leetcode 52. N-Queens II & leetcode 51 N-Queens (N皇后问题)
N皇后问题原创 2017-04-17 11:33:22 · 342 阅读 · 0 评论 -
leetcode 219. Contains Duplicate II
leetcode 219. Contains Duplicate II原创 2017-07-28 18:47:26 · 283 阅读 · 0 评论 -
leetcode 354. Russian Doll Envelopes & leetcode 300 Longest Increasing Subsequence
leetcode 354. Russian Doll Envelopes & leetcode 300 Longest Increasing Subsequence原创 2017-07-28 15:08:51 · 306 阅读 · 0 评论 -
leetcode 330. Patching Array
leetcode 330. Patching Array原创 2017-08-03 13:22:32 · 316 阅读 · 0 评论 -
leetcode 436. Find Right Interval
leetcode 436 find right interval原创 2017-07-19 10:08:47 · 328 阅读 · 0 评论 -
leetcode 363. Max Sum of Rectangle No Larger Than K
leetcode 363 Max Sum of Rectangle No Larger Than K原创 2017-07-22 21:58:41 · 388 阅读 · 0 评论 -
leetcode 650. 2 Keys Keyboard
leetcode 650. 2 Keys Keyboard原创 2017-07-30 13:45:46 · 1627 阅读 · 1 评论 -
拓扑排序
拓扑排序的DFS解法原创 2017-09-23 22:45:35 · 458 阅读 · 0 评论 -
leetcode 552. Student Attendance Record II & 600. Non-negative Integers without Consecutive Ones
leetcode 552. Student Attendance Record II & 600. Non-negative Integers without Consecutive Ones原创 2017-09-15 21:54:36 · 521 阅读 · 0 评论 -
leetcode 773. Sliding Puzzle
写在前面好久没写算法题题解了,实在太忙了。每周的contest都有在做,本周的contest 第二题第三题都算比较有趣的题目,也都A了,先整理一下第三题的解题思路。题目描述On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented b原创 2018-01-28 18:01:11 · 1892 阅读 · 0 评论 -
leetcode 486. Predict the Winner
leetcode 486原创 2017-12-07 11:02:45 · 339 阅读 · 0 评论 -
leetcode 343. Integer Break
leetcode 343. Integer Break原创 2017-11-15 22:07:11 · 219 阅读 · 0 评论 -
leetcode 23. Merge k Sorted Lists
leetcode 23. Merge K Sorted Lists原创 2017-10-14 19:57:01 · 296 阅读 · 0 评论 -
leetcode 653. Two Sum IV - Input is a BST
leetcode 653. Two Sum IV - Input is a BST原创 2017-10-14 19:06:11 · 435 阅读 · 0 评论 -
leetcode 540. Single Element in a Sorted Array
leetcode 540. Single Element in a Sorted Array原创 2017-10-14 18:05:03 · 311 阅读 · 0 评论 -
leetcode 406. Queue Reconstruction by Height
leetcode 406. Queue Reconstruction by Height原创 2017-10-09 23:02:11 · 264 阅读 · 0 评论 -
leetcode 673. Number of Longest Increasing Subsequence
contest 49 LIS原创 2017-09-10 21:18:34 · 1805 阅读 · 0 评论 -
leetcode 666. Path Sum IV
leetcode 666 contest 43原创 2017-09-01 17:22:02 · 1453 阅读 · 0 评论 -
leetcode 316. Remove Duplicate Letters
leetcode 316 remove duplicate letters原创 2017-09-09 15:27:28 · 324 阅读 · 0 评论 -
leetcode 684. Redundant Connection
leetcode 684. Redundant Connection原创 2017-09-25 11:37:19 · 1247 阅读 · 1 评论 -
leetcode 25. Reverse Nodes in k-Group & leetcode 92. Reverse Linked List II
leetcode 25. Reverse Nodes in k-Group原创 2017-08-28 19:47:20 · 385 阅读 · 0 评论 -
leetcode 131. Palindrome Partitioning
leetcode 131 palindrome partitioning原创 2017-07-20 23:52:47 · 249 阅读 · 0 评论 -
leetcode 560. Subarray Sum Equals K & leetcode 1. Two Sum
leetcode 560. Subarray Sum Equals K & leetcode 1. Two Sum原创 2017-07-05 21:34:12 · 1506 阅读 · 0 评论 -
leetcode 328. Odd Even Linked List
leetcode 328 odd even linked list原创 2017-04-20 15:48:47 · 294 阅读 · 0 评论 -
leetcode 516. Longest Palindromic Subsequence
leetcode 516 longest palindromic subsequence原创 2017-05-02 11:43:10 · 387 阅读 · 0 评论 -
leetcode 318. Maximum Product of Word Lengths
leetcode 318 maximum product of word lengths原创 2017-04-19 19:19:43 · 253 阅读 · 0 评论 -
leetcode 206. Reverse Linked List(翻转链表)
这道题的题目描述就跟标题一样了,一个经典问题,基本可以默写出来了,很简单。头插法要创建额外O(n)空间,这里不介绍。 具体代码如下,因为使用了auto,需要在支持C++11的编译器中运行:ListNode* reverseList(ListNode* head) { typedef ListNode* Node; if(head==nullptr) r原创 2017-04-06 10:21:33 · 296 阅读 · 0 评论 -
leetcode 378. Kth Smallest Element in a Sorted Matrix
leetcode 378 Kth Smallest Element in a Sorted Matrix原创 2017-04-14 11:40:24 · 352 阅读 · 0 评论 -
leetcode 494 Target sum
leetcode 494 target sum原创 2017-04-13 21:08:57 · 313 阅读 · 0 评论 -
leetcode 539 & 401
之所以这两题放在一起整理,是觉得两道题目很相近,基本思路一样,而且都是跟时间表示相关的类型。leetcode 539. Minimum Time Difference题目描述:Given a list of 24-hour clock time points in “Hour:Minutes” format, find the minimum minutes difference between a原创 2017-04-05 10:49:20 · 519 阅读 · 0 评论 -
leetcode 481. magical string
题目描述A magical string S consists of only ‘1’ and ‘2’ and obeys the following rules: The string S is magical because concatenating the number of contiguous occurrences of characters ‘1’ and ‘2’ generate原创 2017-04-04 21:06:34 · 510 阅读 · 0 评论 -
leetcode 454. 4Sum II
题目描述: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 problem a bit easier, all A, B, C, D have same len原创 2017-03-27 09:58:48 · 419 阅读 · 0 评论 -
leetcode 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原创 2017-03-26 21:34:50 · 230 阅读 · 0 评论 -
leetcode 477 Total Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total Hamming distance between all pairs of the given nu原创 2017-03-26 21:13:45 · 424 阅读 · 0 评论