摘要: class Solution { public int rob(int[] nums) { if(nums.length==0) return 0; if(nums.length==1) return nums[0]; return Math.max(rob1(nums, 0, nums.le... 阅读全文
posted @ 2017-11-07 08:03 Weiyu Wang 阅读(161) 评论(0) 推荐(0) 编辑
摘要: class Solution { class Trie{ public Trie[] children=new Trie[26]; public boolean isWord=false; public boolean added=false; public void insert(String word) { ... 阅读全文
posted @ 2017-11-07 07:32 Weiyu Wang 阅读(168) 评论(0) 推荐(0) 编辑
摘要: class WordDictionary { private WordDictionary[] children=new WordDictionary[26]; boolean isWord=false; /** Initialize your data structure here. */ public WordDictionary() {... 阅读全文
posted @ 2017-11-07 06:47 Weiyu Wang 阅读(103) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int[] findOrder(int numCourses, int[][] prerequisites) { int[] indegrees=new int[numCourses]; int[][] graph=new int[numCourses][numCourses]; ... 阅读全文
posted @ 2017-11-07 04:28 Weiyu Wang 阅读(140) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int minSubArrayLen(int s, int[] nums) { int i=0; int j=0; int len= Integer.MAX_VALUE; int sum=0; while(j=s) { ... 阅读全文
posted @ 2017-11-07 04:17 Weiyu Wang 阅读(84) 评论(0) 推荐(0) 编辑
摘要: class Trie { Trie[] children=new Trie[26]; boolean isWord=false; /** Initialize your data structure here. */ public Trie() { } /** Inserts a word into... 阅读全文
posted @ 2017-11-07 02:32 Weiyu Wang 阅读(98) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean canFinish(int numCourses, int[][] prerequisites) { int[] indegrees=new int[numCourses]; int[][] graph=new int[numCourses][numCourses]; for(... 阅读全文
posted @ 2017-11-07 02:17 Weiyu Wang 阅读(133) 评论(0) 推荐(0) 编辑