![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
oj
czyifenfei
这个作者很懒,什么都没留下…
展开
-
oj、算法相关
作为一个计算机学院的人,代码能力实在是令人汗颜,没加ACM去训练训练实在是大学中很后悔的一件事情,趁现在还有时间刷刷LeetCode以求来提升自己的代码能力,LeetCode上线了中文网站,跟着里面的探索来吧。...原创 2018-03-29 20:25:51 · 239 阅读 · 0 评论 -
初级算法-数组-从排序数组中删除重复项
LeetCode还是很人性化的 用到什么算法竟然还会提示并有百度百科的链接 此题用到了原地算法,就是输出结果覆盖输入结果,节省空间,附上代码,C语言,代码写的渣,还参考了网上的答案,如有哪里需要改进还请斧正!#include <stdio.h> int removeDuplicates(int* nums, int numsSize) { int pre = 0, cur ...原创 2018-03-29 20:30:31 · 2995 阅读 · 0 评论 -
初级算法-数组-买卖股票的最佳时机 II
#include <stdio.h> int maxProfit(int* prices, int pricesSize) { int max = 0, i; if (pricesSize <= 0) return 0; for (i = 1; i < pricesSize; i++) { if (prices...原创 2018-03-29 21:15:11 · 240 阅读 · 0 评论 -
初级算法-数组-旋转数组
#include <stdio.h> #include <malloc.h> void rotate(int* nums, int numsSize, int k) { int m, i, j, p; m = k % numsSize; p = numsSize - m; int *a = (int *)malloc(m * sizeof(i...原创 2018-04-05 12:42:32 · 142 阅读 · 0 评论