摘要: 前几天去腾讯面试,出的一道手写代码题目。假设有一个数组,[1,2,3,4,5],循环右移两位,变化为[4,5,1,2,3],当时写出来的代码是重新申请了一个数组,所以面试官又让我减少空间复杂度,代码如下:字符串翻转:void reverse(string &s,int... 阅读全文
posted @ 2018-08-07 16:19 依然有清风 阅读(442) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;string multi(string a, string b){ int len1 = a.size(); int len2 = b.size(); //int t[MAX]; int len ... 阅读全文
posted @ 2018-08-07 14:45 依然有清风 阅读(112) 评论(0) 推荐(0) 编辑