- 博客(15)
- 资源 (4)
- 收藏
- 关注
原创 709.转换成小写字母
#include <string>#include <iostream>using namespace std;class Solution {public: string toLowerCase(string str) { if (str.empty()) { return str; ...
2019-04-01 22:31:17 131
原创 771.宝石与石头
version 0.1class Solution {public: int numJewelsInStones(string J, string S) { int count = 0; for (std::string::iterator it = J.begin(); it != J.end(); it++) { ...
2019-04-01 21:57:37 175
原创 订单路由系统的实现
Create a solution for maintaining information about orders that are being placed on an exchange by an order router. This should derive fromIOrderManager (provided in challenge.h).The in-house tradin...
2019-04-01 20:36:19 1464
原创 LRU算法
只考虑了LRU算法的获取数据和存放数据方法,学习了以下链接文章,个人用C++语言写了一遍。另外涉及了内存操作,建议实现个人定义的拷贝和拷贝赋值方法,避免浅拷贝。http://flychao88.iteye.com/blog/1977653#include <list>#include <iostream>using namespace std;cla...
2018-12-05 20:01:00 101
原创 插入排序
#include <iostream>using namespace std;/* insert sort*/template <typename T>void insertSort(T array[], T len){ for (int i = 1, j; i < len; ++i) { T data = array[i...
2018-10-24 21:45:17 98
原创 优先队列
1、error: stray ‘\274’ in program,遇到此类问题,说明存在中文字符,重点检查标点符号;2、注意如下格式中,greater<int>和最后一个>中间需要有一个空格;std::priority_queue<int, std::vector<int>, std::greater<int> >3、 rz -...
2018-08-27 22:52:37 575
原创 堆栈学习之vector实现stack
1、编程注意点见注释2、堆栈常见应用场景有:大数相加,括号匹配等场景3、相比于vector实现堆栈,list实现堆栈更为合适。这样可以避免堆栈大小的限制,且不存在管理未实现空间的问题。#ifndef __VECTOR_STACK__#include <vector>using namespace std;template <typename T, int...
2018-08-22 23:07:17 2397
原创 7.反转整数
类静态变量需要在外部定义,且定义时不带static关键字; 对于数字常量默认为整型,如果表示范围大于整数的表示范围,会有编译告警,需要在后面加上U,例如,2147483648U,如果是long,需要加上UL,long long,则用LLU; 时间时间时间#include <iostream>#include <vector>#include <mat...
2018-08-20 23:45:10 207
原创 1.两数之和
用时优化点:特殊场景判断,减少循环周期; 常数值vector的size只获取一次; 获取目标值之后,立刻返回,避免无用循环调用;#include <iostream>#include <vector>using namespace std;class Solution {public: vector<int> twoSum(v...
2018-08-16 23:57:26 269
原创 stl list相关操作
#include <iostream>#include <algorithm>#include <list>#include <functional>using namespace std;int main(){ list<int> list1; list<int> list2(3, 7);...
2018-08-16 22:47:51 188
原创 模板实现双向链表基本操作
1、template为小写;2、模板编程用的不熟练,尤其是表现在模板符号格式的应用上;3、如果参数为对象,用引用格式,并考虑是否为常引用;#ifndef _TEST_HPP_#define _TEST_HPP_template<typename T>class DLLNode{public: DLLNode() { prev =...
2018-08-09 23:50:03 281
原创 单向链表实现
#ifndef _TEST_HPP_#define _TEST_HPP_class IntSLLNode{public: IntSLLNode() { this->next = NULL; } IntSLLNode(int i, IntSLLNode *in = NULL) { this->info = i; this->next = in; ...
2018-08-08 23:06:27 162
原创 strlen、strcat、strchr、strcmp自实现
#include <stdlib.h>#include <iostream>using namespace std;size_t strlen1(const char* str){ size_t len = 0; while (*str++) ++len; return len;}int strcmp1(const...
2018-07-29 21:27:28 99
原创 一步一步学java之类和对象
/** * */package demo;import java.util.Scanner;/** * @author Administrator * */public class Demo { private static Scanner in; /** * @param args */ public static void main(String[]
2016-04-19 23:14:49 160
vsftpd-3.0.2.tar.gz
2021-09-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人