1、思路:将字符串转化为字符串数组,然后根据下标反向输出 public?void?reverse()?{
String?s?=?"hello";
char[]?c;
c?=?s.toCharArray();??//转化为字符串数组
for?(int?i?=?c.length?...
分类:
其他好文 时间:
2014-07-22 09:10:36
阅读次数:
446
The trick is, we can work on a reversed vector - learnt from EPI.class Solution {public: vector plusOne(vector &digits) { std::reverse(digit...
分类:
其他好文 时间:
2014-07-22 00:33:36
阅读次数:
223
list
----------------------------------------------------------------------
??为什么很多在算法库里有的算法还要在类的成员函数里重新实现一遍?
-->1.因为算法库里的是通用的,对于具体的类来说效率不高。
比如说 reverse 如果直接用 stl_algo.h 里的 reverse,会再调用 iter_swap,
而 iter_swap 的实现方法是借用临时变量来交换两个迭代器指向的元素,这样会调用
好几次构造函数、拷贝方法、析构...
分类:
其他好文 时间:
2014-07-22 00:27:35
阅读次数:
357
错误提示:NoReverseMatch at /admin/ Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found.解决方式:将urls.py中(r'^admin/$', include(admin...
分类:
其他好文 时间:
2014-07-22 00:12:33
阅读次数:
549
java很给力逆序用了Colletcions.reverse();/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; ...
分类:
其他好文 时间:
2014-07-22 00:04:35
阅读次数:
154
public class Solution { public String reverseWords(String s) { String ans=reverse(s); String s2[]=ans.split("\\s+"); ...
分类:
其他好文 时间:
2014-07-21 08:20:33
阅读次数:
203
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before c...
分类:
编程语言 时间:
2014-07-20 22:12:03
阅读次数:
251
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-07-20 21:32:55
阅读次数:
250
如果你反过来看摩尔定理,一个 IT 公司如果今天和十八个月前卖掉同样多的、同样的产品,它的营业额就要降一半。IT 界把它称为反摩尔定理。
分类:
其他好文 时间:
2014-07-19 09:31:04
阅读次数:
230
线上程序不断重启,查看log发现是进程因为SIGXFSZ信号退出。对过大的文件进行操作的时候会产生此信号,一般只在32位机器上出现,文件大小限制为2G。用lsof查看进程打开的文件,果然有一个文件达到2G。
解决方案:编译时加上参数:-D_FILE_OFFSET_BITS=64;代码中调用lseek时参数为off_t(不要为int或long,否则在32位和64位中表现不同)。
...
分类:
系统相关 时间:
2014-07-19 08:18:29
阅读次数:
281