摘要:
归并排序 class Solution { public ListNode sortList(ListNode head) { if(head == null || head.next == null) return head; ListNode fast = head,slow = head; w 阅读全文
摘要:
class Solution { public void reorderList(ListNode head) { if(head == null || head.next == null || head.next.next == null) return; ListNode mid = findM 阅读全文
摘要:
class Solution { public int countPairs(TreeNode root, int distance) { dfs(root,0,distance); return res; } private int res = 0; public List<Integer> df 阅读全文
摘要:
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 = 阅读全文