会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
邹小川
博客园
首页
新随笔
联系
管理
订阅
2017年5月17日
LeetCode ---8. String to Integer (atoi)
摘要: 1 public int myAtoi(String str) { 2 long value = 0; 3 char sign = '\0'; 4 //是否已经存在非零值,存在true,不存在false 5 boolean existNonzero = false; 6 boolean over = fa...
阅读全文
posted @ 2017-05-17 22:04 zouxiaochuan
阅读(165)
评论(0)
推荐(0)
2017年5月15日
LeetCode ---6.ZigZag Conversion
摘要: 更直接简便的解法: Z字形排列之后,每一行元素在原字符串中的位置就是一组(首尾两行)或两组(中间)等差数列
阅读全文
posted @ 2017-05-15 21:09 zouxiaochuan
阅读(127)
评论(0)
推荐(0)
LeetCode ---5.Longest Palindromic Substring
摘要: 1 public String longestPalindrome(String s) { 2 char[] ch = s.toCharArray(); 3 int longestLength = 0; 4 int[] longestIndex = {0, 0}; 5 for(int i = 0; i k && (i +...
阅读全文
posted @ 2017-05-15 12:56 zouxiaochuan
阅读(128)
评论(0)
推荐(0)
2017年5月14日
LeetCode ---3.Longest Substring Without Repeating Characters
摘要: 1 public int lengthOfLongestSubstring(String s) { 2 char[] chars = s.toCharArray(); 3 //存储已遍历的元素中相应char值最后出现的位置 4 HashMap map = new HashMap(); 5 //当遍历到i位置时,lastNoRepeatIndex到i是已遍...
阅读全文
posted @ 2017-05-14 12:48 zouxiaochuan
阅读(148)
评论(0)
推荐(0)
2017年5月12日
LeetCode ---1.TwoSum
摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex
阅读全文
posted @ 2017-05-12 20:45 zouxiaochuan
阅读(168)
评论(0)
推荐(0)
公告