摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-02-18 16:51 糯米米一粒 阅读(117) 评论(0) 推荐(0) 编辑
摘要: linux中 常常用到vim编辑器 至于基本的输入 命令模式的转换 不用多说 在此记记删除命令 删除整行 dd 删除多行 :1,.d回车 命令模式下 前冒号不可忘 删除第一行到当前行 删除多行时,‘.’表示当前行 数字表示文件中行号 中间用逗号隔开 起始和停止行都会被删除 也可在命令中 用‘.’做运 阅读全文
posted @ 2017-02-17 11:36 糯米米一粒 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexi 阅读全文
posted @ 2017-02-16 17:09 糯米米一粒 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" 本题简单来说 就是字符串的处理 阅读全文
posted @ 2017-02-16 16:35 糯米米一粒 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Find All Anagrams in a String 找变位子串: Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of l 阅读全文
posted @ 2017-02-16 16:34 糯米米一粒 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" 本题简单来说 就是字符串的处理 阅读全文
posted @ 2017-02-16 16:30 糯米米一粒 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Find All Anagrams in a String 找变位子串: 本题难度为easy 当看到题目的第一眼 有些怀疑 怎么能等级那么简单 通过网上找到思路后发现 确实不难 现整理总结思路 原字符串s,在s中寻找字符串p的变位字符串的位置,并依次输出,且字符串元素均为小写字母。 思路:首先题目中 阅读全文
posted @ 2017-01-16 21:54 糯米米一粒 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 字符串拷贝 strncpy(): char * strncpy(char*dest, char *src, size_t n);控制拷贝长度,更加安全 strDestination strlen(strDestination):从strDestination后开始 strncpy(strDestin 阅读全文
posted @ 2017-01-03 16:21 糯米米一粒 阅读(111) 评论(0) 推荐(0) 编辑
摘要: int转string一、#include <sstream> int n = 0; std::stringstream ss; std::string str; ss<<n; ss>>str; 二、#include <string> to_string(num); string转int std::s 阅读全文
posted @ 2017-01-03 16:13 糯米米一粒 阅读(115) 评论(0) 推荐(0) 编辑