摘要:
My solution, using stack: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode( 阅读全文
摘要:
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 阅读全文
摘要:
class Solution { private String[] lessThanTwenty = { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twe 阅读全文
摘要:
This problem remember one thing, using HashMap as data structure: class Solution { Map<Integer, Node> map = new HashMap<>(); public Node cloneGraph(No 阅读全文
摘要:
My first solution: class Solution { private int sum =0; public int sumNumbers(TreeNode root) { preOrder(root, ""); return sum; } private void preOrder 阅读全文
摘要:
My back tracking solution1: class Solution { List<String> res = new ArrayList<>(); Set<String> set = new HashSet<>(); public List<String> wordBreak(St 阅读全文
摘要:
My Solution: class Solution { public List<List<Integer>> findRLEArray(int[][] encoded1, int[][] encoded2) { int i=0,j=0; List<int[]> list = new ArrayL 阅读全文
摘要:
My BFS solution: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * Tr 阅读全文