![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
日常小题
文章平均质量分 65
扑街中的二娃
这个作者很懒,什么都没留下…
展开
-
[LeetCode] 410. Split Array Largest Sum
题目链接: https://leetcode.com/problems/split-array-largest-sum/description/DescriptionGiven an array which consists of non-negative integers and an integer m, you can split the array into m non-em原创 2018-01-08 12:08:45 · 750 阅读 · 0 评论 -
[LeetCode] 337. House Robber III
题目链接: https://leetcode.com/problems/house-robber-iii/description/DescriptionThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.”原创 2017-11-29 10:56:29 · 574 阅读 · 0 评论 -
[LeetCode] 3. Longest Substring Without Repeating Characters
题目链接: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/DescriptionGiven a string, find the length of the longest substring without repeating characters.Examples原创 2017-11-20 00:17:59 · 320 阅读 · 0 评论 -
[LeetCode] 475. Heaters
题目链接: https://leetcode.com/problems/heaters/description/DescriptionWinter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now,原创 2017-11-19 23:23:19 · 586 阅读 · 0 评论 -
[LeetCode] 57. Insert Interval
题目链接: https://leetcode.com/problems/insert-interval/description/DescriptionGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that t原创 2017-11-12 21:00:31 · 494 阅读 · 0 评论 -
[LeetCode] 34. Search for a Range
题目链接: https://leetcode.com/problems/search-for-a-range/description/DescriptionGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your a原创 2017-11-12 20:21:41 · 328 阅读 · 0 评论 -
[LeetCode] 442. Find All Duplicates in an Array
题目链接: https://leetcode.com/problems/find-all-duplicates-in-an-array/description/DescriptionGiven an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear on原创 2017-11-01 20:22:16 · 289 阅读 · 0 评论 -
[LeetCode] 32. Longest Valid Parentheses
题目链接: https://leetcode.com/problems/longest-valid-parentheses/description/DescriptionGiven a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) paren原创 2017-11-01 19:37:17 · 273 阅读 · 0 评论 -
[LeetCode] 41. First Missing Positive
题目链接: https://leetcode.com/problems/first-missing-positive/description/DescriptionGiven an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3原创 2017-10-23 22:42:44 · 347 阅读 · 0 评论 -
[LeetCode] 207. Course Schedule
题目链接: https://leetcode.com/problems/course-schedule/description/DescriptionThere are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to原创 2017-11-24 10:40:35 · 294 阅读 · 0 评论 -
[LeetCode] 540. Single Element in a Sorted Array
题目链接: https://leetcode.com/problems/single-element-in-a-sorted-array/description/DescriptionGiven a sorted array consisting of only integers where every element appears twice except for one element wh原创 2017-12-04 15:17:21 · 470 阅读 · 0 评论 -
[LeetCode] 496. Next Greater Element I
题目链接: https://leetcode.com/problems/next-greater-element-i/description/DescriptionYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the原创 2017-11-26 11:01:23 · 332 阅读 · 0 评论 -
[LeetCode] 621. Task Scheduler
题目链接: https://leetcode.com/problems/task-scheduler/description/DescriptionGiven a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters repres原创 2018-01-07 11:07:41 · 839 阅读 · 0 评论 -
[LeetCode] 25. Reverse Nodes in k-Group
题目链接: https://leetcode.com/problems/reverse-nodes-in-k-group/description/DescriptionGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive int原创 2017-12-27 11:11:18 · 366 阅读 · 0 评论 -
[LeetCode] 581. Shortest Unsorted Continuous Subarray
题目链接: https://leetcode.com/problems/shortest-unsorted-continuous-subarray/description/DescriptionGiven an integer array, you need to find one continuous subarray that if you only sort this subarray in原创 2017-12-08 09:31:32 · 281 阅读 · 0 评论 -
[LeetCode] 103. Binary Tree Zigzag Level Order Traversal
题目链接: https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/description/DescriptionGiven a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to原创 2017-12-07 14:14:07 · 381 阅读 · 0 评论 -
[LeetCode] 474. Ones and Zeroes
题目链接: https://leetcode.com/problems/ones-and-zeroes/description/DescriptionIn the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now,原创 2017-12-16 09:16:26 · 509 阅读 · 0 评论 -
[LeetCode] 503. Next Greater Element II
题目链接: https://leetcode.com/problems/next-greater-element-ii/description/DescriptionGiven a circular array (the next element of the last element is the first element of the array), print the Next Great原创 2017-11-27 23:52:34 · 311 阅读 · 0 评论 -
[LeetCode] 75. Sort Colors
题目链接: https://leetcode.com/problems/sort-colors/description/DescriptionGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colo原创 2017-12-23 09:09:37 · 305 阅读 · 0 评论 -
[LeetCode] 310. Minimum Height Trees
题目链接: https://leetcode.com/problems/minimum-height-trees/description/DescriptionFor a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted原创 2017-12-14 10:42:23 · 844 阅读 · 0 评论 -
[LeetCode] 650. 2 Keys Keyboard
题目链接: https://leetcode.com/problems/2-keys-keyboard/description/DescriptionInitially on a notepad only one character ‘A’ is present. You can perform two operations on this notepad for each step:Copy原创 2017-10-14 20:08:07 · 463 阅读 · 0 评论 -
[LeetCode] 4. Median of Two Sorted Arrays
题目链接: https://leetcode.com/problems/median-of-two-sorted-arrays/description/DescriptionThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays原创 2017-10-20 23:19:34 · 281 阅读 · 0 评论 -
[LeetCode] 467. Unique Substrings in Wraparound String
题目链接: https://leetcode.com/problems/unique-substrings-in-wraparound-string/description/DescriptionConsider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will原创 2017-10-27 18:02:49 · 328 阅读 · 0 评论 -
[LeetCode] 35. Search Insert Position
题目链接: https://leetcode.com/problems/search-insert-position/DescriptionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it原创 2016-12-15 14:34:11 · 416 阅读 · 0 评论 -
[C++日常小题] 寻找第k大数字(numberk)
Description经过长时间的筹备工作,在Jourk,Ronny,Plipala,阿长,阿沈等人的努力下,DM实验室建立起自己的系列网站,其中包括三个大板块:DMOJ首页、DMOJ论坛、DMOJ博客。 作为一个大型的网站,数据的加工处理需要用到很多算法系统模块,通过这些模块对系统主数据库进行修改。因此,在构建DMOJ系列网站的过程中,编写了一个庞大的数据统计系统,其中包括一个寻找第k大数字的模原创 2016-12-13 14:10:46 · 7047 阅读 · 0 评论 -
[C++日常小题] Shooting Game
DescriptionErin最近很喜欢玩射击游戏。她刚考完了C语言的期末考试,感觉很溜,于是又来到了射击娱乐场放松一下。和上次一样,先从老板那租了一把步枪和装有N发子弹的弹夹。在射击的过程中,Erin每次都有两种选择:从弹夹中取出一颗子弹上膛,或者打一发子弹出去。注意:所有的子弹都从枪口上膛。Erin感觉这有点像C语言课程中的“栈”的特点。因此在打完了这N发子弹之后,她想验证一下这些子弹打出来的顺原创 2016-12-05 00:14:15 · 611 阅读 · 0 评论 -
[C++日常小题] Find Actual Number of Miles
DescriptionYou are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from the digit 2 to the digit 4 and from the digit 7 to the digi原创 2016-12-05 00:12:30 · 902 阅读 · 0 评论 -
[LeetCode] 330. Patching Array
DescriptionGiven a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusiv原创 2016-12-05 23:32:41 · 744 阅读 · 0 评论 -
[LeetCode] 62. Unique Paths
DescriptionA robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reac原创 2016-12-13 23:51:00 · 503 阅读 · 0 评论 -
[LeetCode] 63. Unique Paths II
题目链接: https://leetcode.com/problems/unique-paths-ii/DescriptionFollow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and原创 2016-12-14 13:07:13 · 392 阅读 · 0 评论 -
[LeetCode] 448. Find All Numbers Disappeared in an Array
题目链接: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/DescriptionGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear原创 2016-12-14 21:56:07 · 881 阅读 · 0 评论 -
[LeetCode] 22. Generate Parentheses
题目链接: https://leetcode.com/problems/generate-parentheses/DescriptionGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a s原创 2016-12-15 16:02:54 · 440 阅读 · 0 评论 -
[LeetCode] 78. Subsets
题目链接: https://leetcode.com/problems/subsets/DescriptionGiven a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nu原创 2016-12-15 17:12:46 · 491 阅读 · 0 评论 -
[C++日常小题] 计算二叉查找树的高度
Description给定一个二叉查找树,要求计算其高度,每个二叉查找树将给出先序与中序的遍历。例如:一个二叉查找树其先序遍历为:16, 10, 4, 15, 23 ; 中序遍历为 4, 10, 15, 16, 23,则其高度为2(假定空树高度为-1,只有根节点的数高度为0)Input第一行输入测试用例个数。对于每个测试用例,第一行是节点个数n,第二行是key值的先序遍历,第三行是key值的中序遍历原创 2017-01-01 10:42:44 · 3653 阅读 · 0 评论 -
[LeetCode] 658. Find K Closest Elements
题目链接: https://leetcode.com/problems/find-k-closest-elements/description/DescriptionGiven a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be原创 2017-10-03 20:34:44 · 1468 阅读 · 0 评论 -
[LeetCode] 134. Gas Station
题目链接: https://leetcode.com/problems/gas-station/description/DescriptionThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited原创 2017-09-20 00:10:50 · 434 阅读 · 0 评论 -
[LeetCode] 135. Candy
题目链接: https://leetcode.com/problems/subsets/DescriptionThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followin原创 2017-09-09 16:00:46 · 446 阅读 · 0 评论 -
[LeetCode] 547. Friend Circles
题目链接: https://leetcode.com/problems/friend-circles/description/DescriptionThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For e原创 2017-09-25 22:43:01 · 553 阅读 · 0 评论 -
[LeetCode] 673. Number of Longest Increasing Subsequence
题目链接: https://leetcode.com/problems/number-of-longest-increasing-subsequence/description/DescriptionGiven an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Inp原创 2017-09-23 09:32:44 · 936 阅读 · 0 评论 -
[LeetCode] 145. Binary Tree Postorder Traversal
[LeetCode] 145. Binary Tree Postorder Traversal 题目链接: https://leetcode.com/problems/binary-tree-postorder-traversal/description/DescriptionGiven a binary tree, return the postorder traversal of its原创 2017-09-06 21:18:50 · 328 阅读 · 0 评论