摘要: My solution, using stack: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode( 阅读全文
posted @ 2022-04-12 12:34 阳光明媚的菲越 阅读(15) 评论(0) 推荐(0) 编辑
摘要: BFS, using PriorityQueue to poll out the smallest number every time. The largest number you get will be the result. class Solution { public int swimIn 阅读全文
posted @ 2022-04-12 07:30 阳光明媚的菲越 阅读(10) 评论(0) 推荐(0) 编辑
摘要: class Solution { private String[] lessThanTwenty = { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twe 阅读全文
posted @ 2022-04-12 07:04 阳光明媚的菲越 阅读(16) 评论(0) 推荐(0) 编辑
摘要: This problem remember one thing, using HashMap as data structure: class Solution { Map<Integer, Node> map = new HashMap<>(); public Node cloneGraph(No 阅读全文
posted @ 2022-04-12 07:03 阳光明媚的菲越 阅读(12) 评论(0) 推荐(0) 编辑
摘要: My first solution: class Solution { private int sum =0; public int sumNumbers(TreeNode root) { preOrder(root, ""); return sum; } private void preOrder 阅读全文
posted @ 2022-04-12 04:48 阳光明媚的菲越 阅读(5) 评论(0) 推荐(0) 编辑
摘要: My back tracking solution1: class Solution { List<String> res = new ArrayList<>(); Set<String> set = new HashSet<>(); public List<String> wordBreak(St 阅读全文
posted @ 2022-04-12 04:17 阳光明媚的菲越 阅读(18) 评论(0) 推荐(0) 编辑
摘要: My Solution: class Solution { public List<List<Integer>> findRLEArray(int[][] encoded1, int[][] encoded2) { int i=0,j=0; List<int[]> list = new ArrayL 阅读全文
posted @ 2022-04-12 04:01 阳光明媚的菲越 阅读(21) 评论(0) 推荐(0) 编辑
摘要: My BFS solution: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * Tr 阅读全文
posted @ 2022-04-12 01:22 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑