上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: https://leetcode.com/problems/binary-tree-postorder-traversal/description/ Description Implement an iterative, post-order traversal of a given binary 阅读全文
posted @ 2018-02-27 01:31 davidnyc 阅读(174) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/sort-list/description/Sort a linked list in O(n log n) time using constant space complexity.找到中点之后的处理,和 143 "Reorder List" 是一样的 : 然后把tail 传后面去 ListNode tail = mid.next ;/... 阅读全文
posted @ 2018-02-26 06:19 davidnyc 阅读(167) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/intersection-of-two-arrays/description/Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Not... 阅读全文
posted @ 2018-02-26 01:33 davidnyc 阅读(161) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/reorder-list/description/Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.... 阅读全文
posted @ 2018-02-25 23:51 davidnyc 阅读(118) 评论(0) 推荐(0)
摘要: 取中点: 翻转: 合并: 插入:使用DUMMY head 避免了头部不确定, 头部为空等各种情况 阅读全文
posted @ 2018-02-25 12:25 davidnyc 阅读(279) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/find-peak-element/description/A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return... 阅读全文
posted @ 2018-02-25 11:56 davidnyc 阅读(92) 评论(0) 推荐(0)
摘要: 这个笨方法也能通过 阅读全文
posted @ 2018-02-25 11:21 davidnyc 阅读(125) 评论(0) 推荐(0)
摘要: 与Find Minimum in Rotated Sorted Array类似。因为rotate, 所以不能直接用Binary Search, 需要进行 二次判定。 case 1: nums[mid] == target, return mid. case 2: nums[mid] < nums[r 阅读全文
posted @ 2018-02-25 09:49 davidnyc 阅读(137) 评论(0) 推荐(0)
摘要: Given a 2D matrix that contains integers only, which each row is sorted in an ascending order. The first element of next row is larger than (or equal 阅读全文
posted @ 2018-02-25 04:34 davidnyc 阅读(227) 评论(0) 推荐(0)
摘要: Given a target integer T and an integer array A sorted in ascending order, find the index i in A such that A[i] is closest to T. Assumptions There can 阅读全文
posted @ 2018-02-25 03:53 davidnyc 阅读(184) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页