正文内容加载中...
posted @ 2017-11-07 08:03 Weiyu Wang 阅读(122) 评论(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 阅读(134) 评论(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 阅读(75) 评论(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 阅读(104) 评论(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 阅读(58) 评论(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 阅读(70) 评论(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 阅读(95) 评论(0) 推荐(0) 编辑
摘要:public class Solution { public int rangeBitwiseAnd(int m, int n) { int r=Integer.MAX_VALUE; while((m&r)!=(n&r)) r=r<<1; return n&r; } } 阅读全文
posted @ 2017-10-31 13:08 Weiyu Wang 阅读(67) 评论(0) 推荐(0) 编辑
摘要:class Solution { public int numIslands(char[][] grid) { int count=0; for(int i=0;i=grid.length||j=grid[0].length||grid[i][j]!='1') return; grid[i][j]='2'; ... 阅读全文
posted @ 2017-10-26 01:48 Weiyu Wang 阅读(84) 评论(0) 推荐(0) 编辑
摘要:class Solution { public List rightSideView(TreeNode root) { List res=new ArrayList(); rightView(root, res, 0); return res; } private void rightView(TreeNode node, ... 阅读全文
posted @ 2017-10-26 01:31 Weiyu Wang 阅读(90) 评论(0) 推荐(0) 编辑