摘要: My back tracking solution: class Solution { List<String> res = new ArrayList<>(); public List<String> generateParenthesis(int n) { backTracking(n, 0 , 阅读全文
posted @ 2022-04-19 11:23 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Stack solution: class Solution { public int scoreOfParentheses(String s) { Stack<Integer> st = new Stack<>(); int score = 0; for(int i = 0; i < s.leng 阅读全文
posted @ 2022-04-19 10:19 阳光明媚的菲越 阅读(15) 评论(0) 推荐(0) 编辑
摘要: My first solution, time complexityO(m*n), where m is the cell number of mat1, and n is the cell number of mat2: class Solution { public int[][] multip 阅读全文
posted @ 2022-04-19 08:15 阳光明媚的菲越 阅读(16) 评论(0) 推荐(0) 编辑
摘要: My first binary search solution: class Solution { public int findKthPositive(int[] arr, int k) { int l=0, r = arr.length-1; while(l+1<r){ int mid = (l 阅读全文
posted @ 2022-04-19 06:53 阳光明媚的菲越 阅读(16) 评论(0) 推荐(0) 编辑