上一页 1 2 3 4 5 6 ··· 14 下一页
摘要: public boolean isValid(String s){ Stack<Character> stack = new Stack<>(); Map<Character, Character> map = new HashMap<>(); map.put('{', '}'); map.put( 阅读全文
posted @ 2020-08-06 14:54 helloworldmybokeyuan 阅读(55) 评论(0) 推荐(0) 编辑
摘要: class MinStack{ private Stack<Integer> dataStack = new Stack<Integer>(); private Stack<Integer> minStack = new Stack<Integer>(); public void push(int 阅读全文
posted @ 2020-08-06 14:53 helloworldmybokeyuan 阅读(49) 评论(0) 推荐(0) 编辑
摘要: class MyStack{ private Queue<Integer> queue = new LinkedList<>(); public void push(int x){ queue.add(x); int cnt = queue.size(); while(cnt-->1){ queue 阅读全文
posted @ 2020-08-06 14:51 helloworldmybokeyuan 阅读(70) 评论(0) 推荐(0) 编辑
摘要: class MyQueue{ private Stack<Integer> in = new Stack<>(); private Stack<Integer> out = new Stack<>(); public void push(int x){ in.push(x); } public in 阅读全文
posted @ 2020-08-06 14:50 helloworldmybokeyuan 阅读(64) 评论(0) 推荐(0) 编辑
摘要: Input: [[1,1,0], [1,1,0], [0,0,1]] Output: 2 Explanation:The 0th and 1st students are direct friends, so they are in a friend circle. The 2nd student 阅读全文
posted @ 2020-08-06 14:45 helloworldmybokeyuan 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Input: 11000 11000 00100 00011 Output: 3 public int numIslands(char[][] grid){ if(grid==null || grid.length==0){ return 0; } int islandNum = 0; for(in 阅读全文
posted @ 2020-08-06 14:42 helloworldmybokeyuan 阅读(93) 评论(0) 推荐(0) 编辑
摘要: [[0,0,1,0,0,0,0,1,0,0,0,0,0], [0,0,0,0,0,0,0,1,1,1,0,0,0], [0,1,1,0,1,0,0,0,0,0,0,0,0], [0,1,0,0,1,1,0,0,1,0,1,0,0], [0,1,0,0,1,1,0,0,1,1,1,0,0], [0,0 阅读全文
posted @ 2020-08-06 14:41 helloworldmybokeyuan 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"] Output: 5 Explanation: As one shortest transformation is " 阅读全文
posted @ 2020-08-06 14:40 helloworldmybokeyuan 阅读(92) 评论(0) 推荐(0) 编辑
摘要: For example, Given board = [ ['A','B','C','E'], ['S','F','C','S'], ['A','D','E','E'] ] word = "ABCCED", -> returns true, word = "SEE", -> returns true 阅读全文
posted @ 2020-08-06 14:21 helloworldmybokeyuan 阅读(514) 评论(0) 推荐(0) 编辑
摘要: private static final String[] KEYS = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}; public List<String> letterCombinations(String digits){ 阅读全文
posted @ 2020-08-06 14:18 helloworldmybokeyuan 阅读(106) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 14 下一页