![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 68
扑街中的二娃
这个作者很懒,什么都没留下…
展开
-
[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 · 737 阅读 · 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 · 528 阅读 · 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 · 306 阅读 · 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 · 568 阅读 · 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 · 486 阅读 · 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 · 321 阅读 · 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 · 278 阅读 · 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 · 264 阅读 · 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 · 339 阅读 · 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 · 458 阅读 · 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 · 282 阅读 · 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 · 453 阅读 · 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 · 824 阅读 · 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 · 347 阅读 · 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 · 274 阅读 · 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 · 363 阅读 · 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 · 503 阅读 · 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 · 299 阅读 · 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 · 293 阅读 · 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 · 835 阅读 · 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 · 308 阅读 · 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 · 275 阅读 · 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 · 320 阅读 · 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 · 1461 阅读 · 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 · 405 阅读 · 0 评论 -
[C++学习笔记] 虚函数用法及注意事项
近期,由于经常会用到虚函数,加上太久没有实践用过此部分的知识,对概念和用法有些混淆,特写此篇来总结归纳一下虚函数的要点和注意事项,以加深自己对虚函数的印象,并希望此文能为他人解决疑惑。 参考书籍:《C++ Primer Plus》虚函数初步认识虚函数在C++中用来实现多态性,可以用指向基类的指针或引用访问派生类同名覆盖函数。这也便实现了同一个指针或引用,当指向不同的类是,调用不同的方法。注意事原创 2016-04-19 22:04:42 · 982 阅读 · 0 评论 -
[C++日常小题] 寻找第k大数字(numberk)
Description经过长时间的筹备工作,在Jourk,Ronny,Plipala,阿长,阿沈等人的努力下,DM实验室建立起自己的系列网站,其中包括三个大板块:DMOJ首页、DMOJ论坛、DMOJ博客。 作为一个大型的网站,数据的加工处理需要用到很多算法系统模块,通过这些模块对系统主数据库进行修改。因此,在构建DMOJ系列网站的过程中,编写了一个庞大的数据统计系统,其中包括一个寻找第k大数字的模原创 2016-12-13 14:10:46 · 6996 阅读 · 0 评论 -
[C++日常小题] Shooting Game
DescriptionErin最近很喜欢玩射击游戏。她刚考完了C语言的期末考试,感觉很溜,于是又来到了射击娱乐场放松一下。和上次一样,先从老板那租了一把步枪和装有N发子弹的弹夹。在射击的过程中,Erin每次都有两种选择:从弹夹中取出一颗子弹上膛,或者打一发子弹出去。注意:所有的子弹都从枪口上膛。Erin感觉这有点像C语言课程中的“栈”的特点。因此在打完了这N发子弹之后,她想验证一下这些子弹打出来的顺原创 2016-12-05 00:14:15 · 598 阅读 · 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 · 897 阅读 · 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 · 738 阅读 · 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 · 480 阅读 · 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 · 384 阅读 · 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 · 873 阅读 · 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 · 434 阅读 · 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 · 486 阅读 · 0 评论 -
[C++] MD5加密算法原理及实现
参考文献: 1. RFC1321 - R. Rivest 2. 中山大学 蔡国扬 老师的 Web安全课件算法概述MD5 使用 little-endian,输入任意不定长度信息,以 512 位长进行分组,生成四个32位数据,最后联合起来输出固定 128 位长的信息摘要。MD5 算法的基本过程为:求余、取余、调整长度、与链接变量进行循环运算、得出结果。在 RFC1321 中,算法共分原创 2017-10-16 17:20:20 · 3040 阅读 · 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 · 427 阅读 · 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 · 440 阅读 · 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 · 546 阅读 · 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 · 921 阅读 · 0 评论