2.2 Linked List & Array
5.1 Linked List
reverse linked list
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: n
@return: The new head of reversed linked list.
"""
def reverse(self, head):
# write your code here
pre = None
while head!= None:
temp = head.next
head.next = pre
pre = head
head = temp
return preReverse Linked List II
Reverse Nodes in k-Groups
Partition List
Merge Two Sorted Lists
Swap Two Nodes in Linked List
Reorder List
Rotate List
Copy List with Random Pointer
141 Linked List Cycle
142 Linked List Cycle II
Sort List
Convert Sorted List to Binary Search Tree
Delete Node in a Linked List
5.2 Array
Merge Sorted Array:
88. Merge Sorted Array
349. Intersection of Two Arrays
350 Intersection of Two Arrays II
4. Median of Two Sorted Arrays
5.3 Subarray(prefix sum)
Maximum Subarray
Subarray Sum
Subarray Sum Closest
\1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold
\915. Partition Array into Disjoint Intervals
5.4 More
26 Remove Duplicates from Sorted Array
27. Remove Element
Find Pivot Index/Balanced Array
Last updated