[抄题]:

A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).

Write a function to determine if a number is strobogrammatic. The number is represented as a string.

For example, the numbers "69", "88", and "818" are all strobogrammatic.

[暴力解法]:

时间分析:

空间分析:

[优化后]:

时间分析:

空间分析:

[奇葩输出条件]:

[奇葩corner case]:

[思维问题]:

class Solution {
public boolean isStrobogrammatic(String num) {
//cc
if (num == null || num.length() == 0) {
return true;
} //for loop
for (int i = 0, j = num.length() - 1; i <= j ; i++, j --) {
if (!"11 00 88 69 96".contains(num.charAt(i) + "" + num.charAt(j))) return false;
} return true;
}
}

不知道对称性怎么处理:两个指针啊!

[一句话思路]:

抽出来之后看字符串中是否互相包含

[输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入):

[画图]:

[一刷]:

[二刷]:

[三刷]:

[四刷]:

[五刷]:

[五分钟肉眼debug的结果]:

[总结]:

判断字符串对称 用对撞型指针

[复杂度]:Time complexity: O(n) Space complexity: O(1)

[英文数据结构或算法,为什么不用别的数据结构或算法]:

[关键模板化代码]:

[其他解法]:

[Follow Up]:

247. Strobogrammatic Number II 找出所有两位的:递归,好吧

[LC给出的题目变变变]:

[代码风格] :

最新文章

  1. 亚马逊S3下载上传文件
  2. Asp.net MVC Comet推送
  3. PHP用curl伪造IP和来源
  4. (转载)robots.txt写法大全和robots.txt语法的作用
  5. nullable,nonnull, null_resettable以及_Null_unspecified的区别和使用
  6. Python Charts库的使用
  7. 设计模式之美:Extension Object(扩展对象)
  8. Installation of Theano on Windows
  9. python 练习 17
  10. 用Spring3编写第一个HelloWorld项目
  11. ERP实施顾问是干什么的?
  12. js中常用的操作字符串的方法大全
  13. goDaddy SSL证书 Nginx配置全流程 (转)
  14. 业余草基于JAVA的模块化开发框架JarsLink
  15. appserver WildFly 8.1 / jboss debug / jboss rmi
  16. quratz启动流程
  17. linux创建快捷方式ln命令
  18. Java的三种代理模式:静态代理/JDK动态代理/Cglib动态代理
  19. centos7 虚拟机安装 以后不能联网问题
  20. Node.js实战(三)之第一个Web服务器

热门文章

  1. Dreamweaver_CS6安装与破解
  2. mysql8之与标准sql的区别
  3. 微博6月底升级后 报 10017/2/statuses/share.json或者10014/2/statuses/share.json错误
  4. 在oracle里,如何取得本周、本月、本季度、本年度的第一天和最后一天的时间
  5. haproxy中两个常用的宏
  6. (转)Socket开发时,Available为0,实际还有数据的问题
  7. Intellij idea run dashboard面板
  8. 数据分析与处理之二(Leveldb 实现原理)
  9. C# 32位程序访问64位注册表
  10. 路边拾遗之其他模块(struct/csv/xlwt/smtp)