Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Robot Movement Rangehistorical
There is a grid with m rows and n columns. A robot starts at coordinate (0,0) and can move one cell at a time left, right, up, or down, but it cannot enter a cell when the sum of the digits of its row and column coordinates is greater than k.
- Maximum in Sliding Windowshistorical
Given an array and a sliding-window size, find the maximum value in every sliding window. For example, for the array {2,3,4,2,6,2,5,1} with window size 3, there are six windows and their maximum values are {4,4,6,6,6,5}.
- Linked List Cycle IIhistorical
Given a linked list, return the first node where the cycle begins. If the list has no cycle, return null.
- Reorder Array with Odd Numbers Before Even Numbershistorical
Given an integer array, implement a function that reorders its numbers so that all odd numbers are in the first half and all even numbers are in the second half, while preserving the relative order among odd numbers and among even numbers.
- Rotate Listhistorical
Given the head head of a linked list, rotate the list to the right by k positions.
- Maximum Sum of a Contiguous Subarrayhistorical
Given an integer array that may contain negative values, find the maximum sum of a contiguous subarray.
- Linked List Cycle IIhistorical
Given a linked list, return the first node where the cycle begins. If the list has no cycle, return null.
- Intersection of Two Linked Listshistorical
Write a program that finds the first node at which two singly linked lists intersect.