会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
技术宅张小二的小窝
我也许走的很慢,但是我一直在前进
首页
新随笔
管理
上一页
1
···
16
17
18
19
20
21
22
23
24
···
34
下一页
2014年7月15日
(java) Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
摘要: 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * ...
阅读全文
posted @ 2014-07-15 23:05 hansongjiang8
阅读(212)
评论(0)
推荐(0)
2014年7月13日
leetcode https://oj.leetcode.com/problems/jump-game-ii/
摘要: 1.超时的,效率太低 1 public class Solution { 2 public int jump(int[] A) { 3 int len=A.length; 4 int d[]=new int[len]; 5 d[0]=0; 6 ...
阅读全文
posted @ 2014-07-13 22:13 hansongjiang8
阅读(349)
评论(0)
推荐(0)
jump game
摘要: 1。第一次觉得很简单,但是超时了 1 public class Solution { 2 public boolean canJump(int[] A) { 3 4 int len=A.length; 5 boolean b[]=new bo...
阅读全文
posted @ 2014-07-13 20:46 hansongjiang8
阅读(170)
评论(0)
推荐(0)
leetcode First Missing Positive hashset简单应用
摘要: 1 public class Solution { 2 public int firstMissingPositive(int[] A) { 3 HashSet hash=new HashSet(); 4 int count=0; 5 int...
阅读全文
posted @ 2014-07-13 19:30 hansongjiang8
阅读(140)
评论(0)
推荐(0)
leetcode distinct-subsequences(DP)
摘要: 参考https://oj.leetcode.com/problems/distinct-subsequences动态规划方程dp[i][j]=dp[i-1][j-1]+dp[i-1][j] (s(i)==t(i))dp[i][j]=dp[i-1][j];边界条件: iif(j==0) d[i][j]...
阅读全文
posted @ 2014-07-13 18:00 hansongjiang8
阅读(143)
评论(0)
推荐(0)
leetcode Longest Common Prefix 多个字符串的最长字串
摘要: 1 public class Solution { 2 public String get(String a,String b) 3 { 4 5 if(a==""||b=="") return ""; 6 int len1=a.le...
阅读全文
posted @ 2014-07-13 00:46 hansongjiang8
阅读(147)
评论(0)
推荐(0)
Longest Consecutive Sequence hashset
摘要: public class Solution { public int longestConsecutive(int[] num) { HashSet hash=new HashSet(); int max=1; for(int n:num) ...
阅读全文
posted @ 2014-07-13 00:21 hansongjiang8
阅读(108)
评论(0)
推荐(0)
2014年7月12日
leetcode shttps://oj.leetcode.com/problems/surrounded-regions/
摘要: 1.从外围搜索O,深度搜索出现了Line 35: java.lang.StackOverflowErrorLast executed input:["OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 1 public class Solution { 2...
阅读全文
posted @ 2014-07-12 23:09 hansongjiang8
阅读(724)
评论(0)
推荐(0)
leetcode排列,求第k个排列
摘要: stl 中的下一个排列在写一遍忘了写个1个多小时,使用递归写的,错误就在我使用一个list保存当前剩下的数,然后利用k/(n-1)!的阶乘就是删除的数字,但进过观察,比如 list={1,2,3}分成3组:1 {2,3}2 {1,3}3 {1,2}确定位于哪个组,然后确定位于哪个组的第几个nyoj ...
阅读全文
posted @ 2014-07-12 22:10 hansongjiang8
阅读(213)
评论(0)
推荐(0)
leetcode 最大矩形和
摘要: 1.枚举法(超时) 1 public class Solution { 2 public int largestRectangleArea(int[] height) { 3 int max=-1; 4 for(int i=0;i=0&&height[k] s...
阅读全文
posted @ 2014-07-12 16:01 hansongjiang8
阅读(434)
评论(0)
推荐(0)
上一页
1
···
16
17
18
19
20
21
22
23
24
···
34
下一页
公告