1. Stack with a min Functionhistorical

    Define a stack data structure and implement a min function in this type that can obtain the minimum element contained in the stack, with O(1) time complexity.

  2. Binary Tree Maximum Path Sumhistorical

    A path in a binary tree may connect any nodes through parent-child edges. Find the nonempty path with the largest sum of node values.

  3. Stack Push and Pop Sequenceshistorical

    Given two integer sequences, the first sequence represents the push order of a stack. Determine whether the second sequence could be a pop order of that stack.

  4. Binary Tree Right Side Viewhistorical

    Given a binary tree, imagine standing on its right side. Return the values of the nodes visible from the right, ordered from top to bottom.

  5. Implement a Queue with Two Stackshistorical

    Use two stacks to implement a queue and complete the queue's Push and Pop operations. The elements in the queue are of type int.

  6. Binary Tree Level Order Traversalhistorical

    Given a binary tree, return the node values obtained by level-order traversal (that is, visit all nodes level by level from left to right).

  7. Search in a 2D Arrayhistorical

    Each row and column of a two-dimensional array is sorted in ascending order. Determine whether a given integer appears in the array.

  8. Serialize and Deserialize Binary Treehistorical

    Serialization converts a data structure or object into a continuous representation so the result can be stored in a file or memory, transmitted over a network, and later reconstructed by the reverse operation.

  9. Two Numbers with Sum Shistorical

    Given an array sorted in increasing order and a number S, find two numbers in the array whose sum is exactly S. If there are multiple pairs whose sum equals S, output the pair with the smallest product.

  10. Binary Tree Zigzag Level Order Traversalhistorical

    Given the root root of a binary tree, return the zigzag level-order traversal of its node values (left to right on one level, then right to left on the next, alternating between levels).