
LeetCode
文章平均质量分 55
David_Jett
我要变得很强!2017-8-30
展开
-
【刷leetcode,拿Offer-009】561. Array Partition I(贪心,C++)
题目链接Given an array of2nintegers, your task is to group these integers intonpairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as l...原创 2017-08-02 15:36:23 · 877 阅读 · 0 评论 -
【刷leetcode,拿Offer-028】104. Maximum Depth of Binary Tree
题目链接:https://leetcode.com/problems/maximum-depth-of-binary-tree/题面:104.Maximum Depth of Binary TreeEasy135254FavoriteShareGiven a binary tree, find its maximum depth.The maximum depth is ...原创 2019-06-23 21:42:48 · 200 阅读 · 0 评论 -
【刷leetcode,拿Offer-027】559. Maximum Depth of N-ary Tree
题目链接:https://leetcode.com/problems/maximum-depth-of-n-ary-tree/题面:559.Maximum Depth of N-ary TreeEasy35920FavoriteShareGiven a n-ary tree, find its maximum depth.The maximum depth is the ...原创 2019-06-23 21:38:26 · 246 阅读 · 0 评论 -
【刷leetcode,拿Offer-026】922. Sort Array By Parity II
题目链接:https://leetcode.com/problems/sort-array-by-parity-ii/题面:922.Sort Array By Parity IIEasy29629FavoriteShareGiven an arrayAof non-negative integers, half of the integers in A are odd, ...原创 2019-06-22 21:22:50 · 244 阅读 · 0 评论 -
【刷leetcode,拿Offer-025】1078. Occurrences After Bigram
题目链接:https://leetcode.com/problems/occurrences-after-bigram/题面:1078.Occurrences After BigramEasy3138FavoriteShareGiven wordsfirstandsecond, consider occurrences in sometextof the form ...原创 2019-06-22 21:13:47 · 345 阅读 · 0 评论 -
【刷leetcode,拿Offer-024】589. N-ary Tree Preorder Traversal
题目链接:https://leetcode.com/problems/n-ary-tree-preorder-traversal/题面:589.N-ary Tree Preorder TraversalEasy23135FavoriteShareGiven an n-ary tree, return thepreordertraversal of its nodes' v...原创 2019-06-22 21:00:58 · 229 阅读 · 0 评论 -
【刷leetcode,拿Offer-023】590. N-ary Tree Postorder Traversal
题目链接:https://leetcode.com/problems/n-ary-tree-postorder-traversal/题面:590.N-ary Tree Postorder TraversalEasy29137FavoriteShareGiven an n-ary tree, return thepostordertraversal of its nodes...原创 2019-06-22 20:58:10 · 258 阅读 · 0 评论 -
【刷leetcode,拿Offer-022】933. Number of Recent Calls
题目链接:933. Number of Recent Calls题面:933.Number of Recent CallsEasy133647FavoriteShareWrite a classRecentCounterto count recent requests.It has only one method:ping(int t), where t repre...原创 2019-06-21 21:31:42 · 249 阅读 · 0 评论 -
【刷leetcode,拿Offer-021】763. Partition Labels
题目链接:763. Partition Labels题面:763.Partition LabelsMedium96954FavoriteShareA stringSof lowercase letters is given. We want to partition this string into as many parts as possible so that ea...原创 2019-06-20 20:55:25 · 218 阅读 · 0 评论 -
【刷leetcode,拿Offer-029】136. Single Number
题目链接:https://leetcode.com/problems/single-number/题面:136.Single NumberEasy251694FavoriteShareGiven anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single...原创 2019-06-23 21:45:43 · 178 阅读 · 0 评论 -
【刷leetcode,拿Offer-030】94. Binary Tree Inorder Traversal
题目链接:https://leetcode.com/problems/binary-tree-inorder-traversal/题面:94.Binary Tree Inorder TraversalMedium166372FavoriteShareGiven a binary tree, return theinordertraversal of its nodes' ...原创 2019-06-23 21:50:37 · 207 阅读 · 0 评论 -
【刷leetcode,拿Offer-038】1030. Matrix Cells in Distance Order
题目链接:https://leetcode.com/problems/matrix-cells-in-distance-order/题面:1030.Matrix Cells in Distance OrderEasy7240FavoriteShareWe are given a matrix withRrows andCcolumns has cells with i...原创 2019-06-27 20:21:23 · 321 阅读 · 0 评论 -
【刷leetcode,拿Offer-037】169. Majority Element
题目链接:https://leetcode.com/problems/majority-element/题面:169.Majority ElementEasy1714152FavoriteShareGiven an array of sizen, find the majority element. The majority element is the element t...原创 2019-06-27 20:16:56 · 342 阅读 · 0 评论 -
【刷leetcode,拿Offer-036】217. Contains Duplicate
题目链接:https://leetcode.com/problems/contains-duplicate/题面:217.Contains DuplicateEasy405524FavoriteShareGiven an array of integers, find if the array contains any duplicates.Your function s...原创 2019-06-24 20:59:03 · 265 阅读 · 0 评论 -
【刷leetcode,拿Offer-035】242. Valid Anagram
题目链接:https://leetcode.com/problems/valid-anagram/题面:242.Valid AnagramEasy729109FavoriteShareGiven two stringssandt, write a function to determine iftis an anagram ofs.Example 1:...原创 2019-06-24 20:49:10 · 240 阅读 · 0 评论 -
【刷leetcode,拿Offer-034】78. Subsets
题目链接:https://leetcode.com/problems/subsets/题面:78.SubsetsMedium199151FavoriteShareGiven a set ofdistinctintegers,nums, return all possible subsets (the power set).Note:The solution set...原创 2019-06-24 20:33:22 · 224 阅读 · 0 评论 -
【刷leetcode,拿Offer-033】283. Move Zeroes
题目链接:https://leetcode.com/problems/move-zeroes/题面:283.Move ZeroesEasy208477FavoriteShareGiven an arraynums, write a function to move all0's to the end of it while maintaining the relative...原创 2019-06-24 20:13:52 · 194 阅读 · 0 评论 -
【刷leetcode,拿Offer-032】238. Product of Array Except Self
题目链接:题面:238.Product of Array Except SelfMedium2317197FavoriteShareGiven an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of al...原创 2019-06-24 14:09:31 · 195 阅读 · 0 评论 -
【刷leetcode,拿Offer-031】22. Generate Parentheses
题目链接:https://leetcode.com/problems/generate-parentheses/题面:22.Generate ParenthesesMedium2848177FavoriteShareGivennpairs of parentheses, write a function to generate all combinations of we...原创 2019-06-24 10:44:55 · 208 阅读 · 0 评论 -
【刷leetcode,拿Offer-020】1021. Remove Outermost Parentheses
题目链接:LeetCode 1021题面:1021.Remove Outermost ParenthesesEasy122181FavoriteShareA valid parentheses string is either empty(""),"(" + A + ")", orA + B, whereAandBare valid parentheses st...原创 2019-06-20 18:51:27 · 276 阅读 · 0 评论 -
【刷leetcode,拿Offer-019】1038. Binary Search Tree to Greater Sum Tree
题目链接:https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/题面:1038.Binary Search Tree to Greater Sum TreeMedium14918FavoriteShareGiven the root of a binarysearchtree with d...原创 2019-06-18 21:32:31 · 253 阅读 · 0 评论 -
【刷leetcode,拿Offer-008】575. Distribute Candies(贪心)
题目链接题面:575. Distribute CandiesDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven an integer array withevenlength, where different numbers in this array represent differen...原创 2017-08-25 11:11:09 · 752 阅读 · 0 评论 -
LeetCode——344. Reverse String(字符串反转)
题目链接题目:344. Reverse StringDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneWrite a function that takes a string as input and retur原创 2017-08-26 17:11:36 · 516 阅读 · 0 评论 -
【刷leetcode,拿Offer-005】665. Non-decreasing Array
题目链接题面:Add to List665. Non-decreasing ArrayDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven an array withnintegers, your task is to check if it could become non...原创 2017-10-12 17:01:09 · 673 阅读 · 0 评论 -
【刷leetcode,拿Offer-013】496. Next Greater Element I(栈应用)
题目链接题面:Add to List496. Next Greater Element IDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneYou are given two arrays(without duplicates)nums1andnums2wherenums1’...原创 2017-10-21 10:38:59 · 411 阅读 · 0 评论 -
【刷leetcode,拿Offer-011】503. Next Greater Element II
题目链接题面:Add to List503. Next Greater Element IIDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven a circular array (the next element of the last element is the first...原创 2017-10-21 13:50:05 · 779 阅读 · 0 评论 -
【刷leetcode,拿Offer-018】2. Add Two Numbers
题目链接题面:2. Add Two NumbersDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneYou are given twonon-emptylinked lists representing two non-negative integers. The digits are sto...原创 2017-10-25 18:41:38 · 654 阅读 · 0 评论 -
【刷leetcode,拿Offer-017】3. Longest Substring Without Repeating Characters(字符串+思维)
3. Longest Substring Without Repeating CharactersDescription: Given a string, find the length of the longest substring without repeating characters.Examples: Given “abcabcbb”, the answer is “abc”, wh原创 2017-11-18 13:16:45 · 482 阅读 · 2 评论 -
【刷leetcode,拿Offer-003】657.Judge Route Circle
题目链接题面:Add to List657. Judge Route CircleDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneInitially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if...原创 2017-08-21 19:47:09 · 1501 阅读 · 0 评论 -
【刷leetcode,拿Offer-010】557. Reverse Words in a String III
题目链接题面:557. Reverse Words in a String IIIDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven a string, you need to reverse the order of characters in each word within a s...原创 2017-08-21 20:18:28 · 778 阅读 · 0 评论 -
【刷leetcode,拿Offer-012】500. Keyboard Row(模拟题)
题目链接题面:500. Keyboard RowDescriptionHintsSubmissionsDiscussSolutionDiscussPick OneGiven a List of words, return the words that can be typed using letters ofalphabeton only one row'...原创 2017-08-21 19:58:26 · 748 阅读 · 0 评论 -
【刷leetcode,拿Offer-002】682. Baseball Game(模拟)
题目链接 Description: You’re now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round’s score): Directly represents the number of poi原创 2017-11-24 12:29:40 · 658 阅读 · 0 评论 -
【刷leetcode,拿Offer-001】728. Self Dividing Numbers
题目链接题面: A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.Also, a self-div原创 2017-11-22 21:40:25 · 889 阅读 · 0 评论 -
【刷leetcode,拿Offer-016】83 Remove Duplicates from Sorted List(模拟)
题目链接:Remove Duplicates from Sorted List题面:Remove Duplicates from Sorted ListTotal Accepted:58257Total Submissions:168776My SubmissionsQuestionSolutionGiven a sorted linked lis...原创 2015-05-23 23:04:45 · 1048 阅读 · 0 评论 -
【刷leetcode,拿Offer-015】461. Hamming Distance(C++,模拟)
题目链接TheHamming distancebetween two integers is the number of positions at which the corresponding bits are different.Given two integersxandy, calculate the Hamming distance.Note:0 ≤x,y&...原创 2017-08-01 14:58:11 · 392 阅读 · 0 评论 -
【刷leetcode,拿Offer-007】595. Big Countries(mysql)
题目链接There is a tableWorld+-----------------+------------+------------+--------------+---------------+| name | continent | area | population | gdp |+--------...原创 2017-08-01 15:18:23 · 563 阅读 · 0 评论 -
【刷leetcode,拿Offer-004】627. Swap Salary(数据库,sql)
题目链接Given a tablesalary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update query and no ...原创 2017-08-02 15:58:43 · 2032 阅读 · 0 评论 -
【刷leetcode,拿Offer-006】617. Merge Two Binary Trees(递归,C++)
题目链接Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new...原创 2017-08-02 15:14:13 · 1205 阅读 · 0 评论 -
【刷leetcode,拿Offer-014】476. Number Complement(二进制,C++)
题目链接Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the ...原创 2017-08-02 17:06:56 · 823 阅读 · 0 评论 -
【刷leetcode,拿Offer-039】1028. Recover a Tree From Preorder Traversal
题目链接:https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/题面:1028.Recover a Tree From Preorder TraversalHard1625FavoriteShareWe run apreorderdepth first search on theroot...原创 2019-06-27 20:34:12 · 418 阅读 · 0 评论