- 博客(7)
- 收藏
- 关注
原创 【dp】和为M的组合个数
题目类型:0-1背包问题,动态规划题目描述:在N个数中找出其和为M的若干个数。先读入正整数N(1< N< 100)和M(1< M< 10000), 再读入N个正数(可以有相同的数字,每个数字均在1000以内), 在这N个数中找出若干个数, 使它们的和是M, 把满足条件的数字组合都找出来以统计组合的个数,输出组合的个数(不考虑组合是否相同)。要求你的程序运行时间不超过...
2019-03-28 21:51:17 683
原创 【最小栈】最小栈的实现与优化
最小栈实现一个最小栈,一步一步优化,从额外空间O(N) 到O(1) 。push,pop,top,getMin都是O(1)时间。1 用一个最小栈来存储最小值1.1要点:2个栈,data用来存储数据,minValue用来存储最小值。 push时,data直接push数据;minValue直接放入当前最小的值。(对于minValue有一个优化,当push的数据比当前最小值大的时候,我们...
2019-03-22 19:59:43 336
原创 【字节跳动】2019后端笔试题
早上10点的笔试,晕的要死,竟然没ak。。。都是因为第二题用了自己不熟悉的指针,一直找错。。#include <iostream>#include<cstring>#include<cmath>#include<string>#include<map>#include<algorithm>#include&l...
2019-03-16 13:22:45 5912
原创 【LeetCode】merge-two-sorted-lists
merge-two-sorted-lists时间限制:1秒 空间限制:32768K 热度指数:8819本题知识点: 链表 leetcode算法知识视频讲解 题目描述Merge two sorted linked lists and return it as a new list. The new list should be made by splicing togeth...
2019-03-15 16:24:11 151
原创 【LeetCode】merge-sorted-array
时间限制:1秒 空间限制:32768K 热度指数:8547本题知识点: 数组 leetcode算法知识视频讲解 题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hol...
2019-03-15 16:14:52 149
原创 【排序】
分类:1:插入排序①直接插入排序② 折半插入排序③希尔排序2:交换排序①冒泡排序②快速排序3:选择排序① 简单选择排序②堆排序4:归并排序5:基数排序...
2019-03-02 20:55:59 232
原创 POJ - 3126 Prime Path【图论bfs】
Prime PathPOJ - 3126The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their office...
2019-03-01 16:01:53 182
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人