1. Climbing Stairshistorical

    A staircase has n steps, and each move climbs one or two steps. Count the distinct ways to reach the top.

  2. Search in Rotated Sorted Arrayhistorical

    Given a rotated sorted array whose rotation count is unknown in advance (for example, 0 1 2 4 5 6 7 may become 4 5 6 7 0 1 2). Search for the given target value in the array.

  3. Search in Rotated Sorted Arrayhistorical

    Given a rotated sorted array whose rotation count is unknown in advance (for example, 0 1 2 4 5 6 7 may become 4 5 6 7 0 1 2). Search for the given target value in the array.

  4. Merge Two Sorted Arrayshistorical

    Merge two sorted integer arrays A and B into A while preserving order. Assume A has enough space for all elements.

  5. Find Peak Elementhistorical

    A peak element is strictly greater than its neighbors. Find a peak in the given array and return its index.

  6. Find the K-th Largesthistorical

    Given an integer array, use the idea of quicksort to find the K-th largest number in the array.

  7. Binary Searchhistorical

    Given an n-element sorted (ascending) integer array nums and a target value target, write a function to search for target in nums. If the target exists, return its index; otherwise return -1.

  8. Find Minimum in Rotated Sorted Arrayhistorical

    Given a rotated ascending array, find its minimum element.

  9. Square Roothistorical

    Implement the function int sqrt(int x). Compute and return the square root of x, rounded down.

  10. Spiral Matrixhistorical

    Given an m-row, n-column matrix, return all elements of the matrix in clockwise spiral order.