Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Entry Node of a Loop in a Linked Listhistorical
Given a linked list, if it contains a cycle, find the entry node of the cycle; otherwise, return null.
- Best Time to Buy and Sell Stockhistorical
Given daily stock prices, find the maximum profit from a single purchase followed by a single sale.
- First Common Node of Two Linked Listshistorical
Given two linked lists, find their first common node. (Note: because the input data is provided as linked lists, invalid test data may be displayed in other ways; the input data is guaranteed to be valid.).
- Rotate Imagehistorical
Given an n x n two-dimensional matrix matrix representing an image, rotate the image 90 degrees clockwise.
- Delete Duplicate Nodes in a Linked Listhistorical
In a sorted linked list, duplicate nodes may exist. Delete all duplicate nodes from the list without retaining any duplicate occurrence, and return the head pointer.
- Implement Trie (Prefix Tree)historical
Implement a Trie (prefix tree) with the three operations insert, search, and startsWith.
- Postorder Traversal Sequence of a Binary Search Treehistorical
Given an integer array, determine whether it is the postorder traversal result of a binary search tree. Return true if it is, otherwise return false. Assume that any two numbers in the input array are distinct.
- Unique Binary Search Treeshistorical
Given an integer n, determine how many binary search trees can be formed using nodes 1 ... n.
- Next Node in a Binary Treehistorical
Given a binary tree and one of its nodes, find and return the next node in inorder traversal order. Note that each tree node contains not only left and right child pointers, but also a pointer to its parent.
- Binary Tree Inorder Traversalhistorical
Given the root root of a binary tree, return its inorder traversal.