摘要:
```/** * 21. Merge Two Sorted Lists * 1. Time:O(min(m,n)) Space:O(1) * 2. Time:O(m+n) Space:O(m+n) */// 1. Time:O(min(m,n)) Space:O(1)class Solution { public ListNode mergeTwoLists(ListNode l1, Lis... 阅读全文
摘要:
``` /** * 88. Merge Sorted Array * 1. Time:O(m+n) Space:O(m) * 2. Time:O(m+n) Space:O(1) */ // 1. Time:O(m+n) Space:O(m) class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { in 阅读全文
摘要:
``` /** * 147. Insertion Sort List * 1. Time:O(n2) Space:O(1) * 2. Time:O(n2) Space:O(1) */ // 1. Time:O(n2) Space:O(1) class Solution { public ListNode insertionSortList(ListNode head) { ListNode dum 阅读全文
摘要:
``` /** * 307. Range Sum Query - Mutable * 1. Time:O(n) Space:O(1) * 2. Time:O(logn) Space:O(1) * 3. Time:O(logn) Space:O(1) */ // 1. Time:O(n) Space:O(1) class NumArray { private int[] nums; public N 阅读全文