代码改变世界

[LeetCode] 4. Median of Two Sorted Arrays_Hard tag: Array, Binary Search

2019-05-10 11:39 by Johnson_强生仔仔, 191 阅读, 0 推荐, 收藏, 编辑
摘要:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文

[LeetCode] 系统刷题7_Array & numbers & string

2019-05-09 11:22 by Johnson_强生仔仔, 344 阅读, 0 推荐, 收藏, 编辑
摘要:1. 2 D Array 如果是在左上到右下的斜线的话,在同一条斜线上的x - y 相等, (x, y) 是该点的坐标 如果是在左下到右上的斜线的话,在同一条斜线上的x + y 相等, (x, y) 是该点的坐标 ex. [(1, 1), (1, 2), (1, 3)] [(2, 1), (2, 2 阅读全文

[LeetCode] 189. Rotate Array_Easy tag: Array

2019-05-09 11:16 by Johnson_强生仔仔, 194 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Note: Try to come up as many solutions as you 阅读全文

[LeetCode] 234. Palindrome Linked List_Easy tag: Linked List

2019-05-06 06:27 by Johnson_强生仔仔, 271 阅读, 0 推荐, 收藏, 编辑
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: 阅读全文

[LeetCode] 109. Convert Sorted List to Binary Search Tree_Medium tag: Linked List

2019-05-06 05:00 by Johnson_强生仔仔, 274 阅读, 0 推荐, 收藏, 编辑
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文

[LeetCode] 138. Copy List with Random Pointer_Medium tag: Linked List

2019-05-04 11:06 by Johnson_强生仔仔, 210 阅读, 0 推荐, 收藏, 编辑
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文

[LeetCode] 23. Merge k Sorted Lists_Hard tag: Linked List

2019-05-03 11:33 by Johnson_强生仔仔, 176 阅读, 0 推荐, 收藏, 编辑
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 阅读全文

[LeetCode] 143. Reorder List_Middle tag: Linked List

2019-05-03 10:37 by Johnson_强生仔仔, 300 阅读, 0 推荐, 收藏, 编辑
摘要:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list's nodes, only nodes its 阅读全文

[LeetCode] 148. Sort List_Middle tag: Linked List

2019-05-02 11:11 by Johnson_强生仔仔, 212 阅读, 0 推荐, 收藏, 编辑
摘要:Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4-> 阅读全文

[LeetCode] 21. Merge Two Sorted Lists_Easy tag: Linked List

2019-05-02 10:49 by Johnson_强生仔仔, 255 阅读, 0 推荐, 收藏, 编辑
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 39 下一页