摘要: 归并排序 class Solution { public ListNode sortList(ListNode head) { if(head == null || head.next == null) return head; ListNode fast = head,slow = head; w 阅读全文
posted @ 2020-07-27 15:36 Sexyomaru 阅读(77) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void reorderList(ListNode head) { if(head == null || head.next == null || head.next.next == null) return; ListNode mid = findM 阅读全文
posted @ 2020-07-27 11:28 Sexyomaru 阅读(63) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int countPairs(TreeNode root, int distance) { dfs(root,0,distance); return res; } private int res = 0; public List<Integer> df 阅读全文
posted @ 2020-07-27 10:55 Sexyomaru 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 1524. 和为奇数的子数组数目 class Solution { public int numOfSubarrays(int[] arr) { int n = arr.length; int sum = 0; int res = 0, odd = 0, even = 1; for(int i = 阅读全文
posted @ 2020-07-27 10:30 Sexyomaru 阅读(82) 评论(0) 推荐(0) 编辑