题目:请实现一个函数,把字符串中的每个空格替换成“%20”。例如输入“We are happy.”,则输出“We%20are%20happy.”。解题思路:以时间效率优先的话,可以分为两种处理办法,一种利用辅助内存,即新开辟一个数组,时间复杂度为O(n)另一种不用辅助内存,即在原数组上操作:1.先遍...
分类:
其他好文 时间:
2015-05-04 22:04:00
阅读次数:
112
May is finally here, which I have been looking forward for a while.The past month--April has been really terrible and troublesome, even though I had t...
分类:
移动开发 时间:
2015-05-04 17:51:47
阅读次数:
145
1 题目描述Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive i...
分类:
移动开发 时间:
2015-05-04 17:29:12
阅读次数:
145
https://leetcode.com/problems/happy-number/Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following ...
分类:
移动开发 时间:
2015-05-04 15:12:32
阅读次数:
123
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares...
分类:
移动开发 时间:
2015-05-03 10:43:52
阅读次数:
145
1. 题目Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the square...
分类:
移动开发 时间:
2015-05-01 14:50:56
阅读次数:
134
题目:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive inte...
分类:
移动开发 时间:
2015-05-01 07:10:07
阅读次数:
143
public class Solution { public boolean isHappy(int n) { int sum=0; if(n==1||n==7) return true; else if(n>1&&n0){ ...
分类:
移动开发 时间:
2015-04-30 23:07:25
阅读次数:
144
Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi...
分类:
移动开发 时间:
2015-04-30 21:51:17
阅读次数:
174
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/45396585
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace th...
分类:
移动开发 时间:
2015-04-30 18:20:49
阅读次数:
141