- 博客(6)
- 收藏
- 关注
原创 LeetCode-001 Two Sum
给定一个整数数组,返回这两个数字的索引,使它们合计成一个特定的目标。您可能会认为每个输入都只有一个解决方案,并且您可能不会使用相同的元素两次。例:鉴于NUMS = [2,7,11,15],目标= 9,因为NUMS [ 0 ] + NUMS [ 1 ] = 2 + 7 = 9,返回[ 0,1 ]。Given an array of integers, return indices of the...
2018-03-22 18:25:46
221
转载 栈在O(1)时间内求min值
实现一个栈Stack,要求实现Push(出栈)、Pop(入栈)、Min(返回最小值的操作)的时间复杂度为O(1)思路:1:在stack的数据结构中加两个个字段,如 typedef struct { int data[MAX]; // 存储栈中的所有数 int top; // 存储栈顶元素在data数组中的位置 int min; // 最小值 ...
2018-03-13 21:46:18
244
原创 读书有疑
开篇文章回顾我的学习记录目前正在艹 《C primer plus》 《android 应用程序开发与典型案例》《算法竞赛入门指南》《算法导论》这四本书2015年9月19日 一个月时间争取搞完这四本。
2015-09-19 10:39:48
213
原创 ACM-STEP Rank
RankProblem DescriptionJackson wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute Jackson’s rank in class; that is, if he has
2015-09-17 16:44:42
231
原创 ACM-Saving HDU
网上的例程#include#includeusing namespace std;struct TS{ int pi; //单位体积的价值 int mi; //总有体积};bool cmp(TS a,TS b){ return a.pi>b.pi;}
2015-09-15 10:47:18
307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人