Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Numbers Appearing Only Oncehistorical
In an integer array, every number appears twice except for two numbers. Write a program to find the two numbers that appear only once.
- Remove Duplicates from Sorted List IIhistorical
Given the head head of a sorted linked list, delete all nodes whose values are duplicated, leaving only values that appear once. Return the sorted linked list.
- Inverse Pairs in an Arrayhistorical
An inversion occurs when an earlier array element is greater than a later one. Count all inversions in the given array.
- Remove Duplicates from Sorted Listhistorical
Given the head head of a sorted linked list, delete duplicate elements so that each value appears only once. Return the sorted linked list.
- Duplicate Number in an Arrayhistorical
An array of length n contains values from 0 to n - 1, with some values repeated. Find a duplicate value.
- Remove Nth Node From End of Listhistorical
Given a linked list, remove the nth node from the end and return the head of the list. For example, given the linked list: 1->2->3->4->5, n = 2. after removing the nth node from the end, the list becomes 1->2->3->5.
- Minimum Number in a Rotated Arrayhistorical
Moving some elements from the beginning of an array to the end is called a rotation of the array. Given a rotation of a non-decreasingly sorted array, output the minimum element of the rotated array.
- Smallest K Numbershistorical
Given n integers, find the smallest K numbers. For example, among 4,5,1,6,2,7,3,8, the smallest four numbers are 1,2,3,4.