会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
thehappyyouth
2014年7月31日
leetcode--014 Gas station
摘要: 1 public int canCompleteCircuit(int[] gas, int[] cost) { 2 int begin=0; 3 int sum=0; 4 int i=0; 5 int n=0; 6 ...
阅读全文
posted @ 2014-07-31 13:54 thehappyyouth
阅读(238)
评论(0)
推荐(0)
编辑
leetcode--012 single number I
摘要: 1 public int singleNumber(int[] A) {2 int s=0;3 for(int i=0;i<A.length;i++){4 s=s^A[i];5 } 6 return...
阅读全文
posted @ 2014-07-31 13:52 thehappyyouth
阅读(135)
评论(0)
推荐(0)
编辑
leetcode--011 copy list with random pointer
摘要: 1 package leetcode; 2 3 class RandomListNode { 4 int label; 5 RandomListNode next, random; 6 7 public RandomListNode(int x) { 8 ...
阅读全文
posted @ 2014-07-31 13:50 thehappyyouth
阅读(158)
评论(0)
推荐(0)
编辑
leetcode--010 Linked List Cycle II
摘要: 1 public ListNode detectCycle(ListNode head) { 2 ListNode s=head; 3 ListNode f=head; 4 while(f!=null&&f.next!=null){ 5 ...
阅读全文
posted @ 2014-07-31 13:48 thehappyyouth
阅读(137)
评论(0)
推荐(0)
编辑
leetcode--009 Linked List Cycle I
摘要: 1 public boolean hasCycle(ListNode head) { 2 ListNode s=head; 3 ListNode f=head; 4 while(f!=null&&f.next!=null){ 5 ...
阅读全文
posted @ 2014-07-31 13:47 thehappyyouth
阅读(123)
评论(0)
推荐(0)
编辑
leetcode--007 word break I
摘要: 注意:不一定是一分为2 1 package leetcode; 2 3 import java.util.Set; 4 5 public class WordBreak11 { 6 public boolean wordBreak(String s, Set dict) { 7 ...
阅读全文
posted @ 2014-07-31 13:45 thehappyyouth
阅读(171)
评论(0)
推荐(0)
编辑
公告
导航
博客园
首页
新随笔
新文章
联系
订阅
管理