摘要: class Solution { public boolean isStrobogrammatic(String num) { Map<Character, Character> map = new HashMap<>(); map.put('0', '0'); map.put('1', '1'); 阅读全文
posted @ 2022-04-09 13:34 阳光明媚的菲越 阅读(33) 评论(0) 推荐(0) 编辑
摘要: My PriorityQueue Solution: class Solution { public int[][] intervalIntersection(int[][] firstList, int[][] secondList) { PriorityQueue<int[]> pq1 = ne 阅读全文
posted @ 2022-04-09 13:16 阳光明媚的菲越 阅读(15) 评论(0) 推荐(0) 编辑
摘要: My Solution 1: class Solution { public ListNode mergeKLists(ListNode[] lists) { PriorityQueue<ListNode> queue = new PriorityQueue<>((a,b)-> a.val-b.va 阅读全文
posted @ 2022-04-09 06:11 阳光明媚的菲越 阅读(9) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String addStrings(String num1, String num2) { StringBuilder res = new StringBuilder(); int carry = 0; int i=num1.length()-1, j 阅读全文
posted @ 2022-04-09 05:55 阳光明媚的菲越 阅读(12) 评论(0) 推荐(0) 编辑
摘要: class MovingAverage { Queue<Integer> queue = new LinkedList<>(); int size = 0; double sum=0; public MovingAverage(int size) { this.size = size; } publ 阅读全文
posted @ 2022-04-09 05:25 阳光明媚的菲越 阅读(14) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean isPalindrome(String s) { s= s.toLowerCase(); int i=0, j=s.length()-1; while(i<j){ char a = s.charAt(i); char b = s.cha 阅读全文
posted @ 2022-04-09 04:32 阳光明媚的菲越 阅读(11) 评论(0) 推荐(0) 编辑
摘要: We use two points to point to two successive nodes, we call them "pre" and "cur" We need to consider 3 situation need to be considered: 1. the inserte 阅读全文
posted @ 2022-04-09 02:34 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑