GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rulcode
  • Sign In

This view

  • Original page
  • New address

GeezerVison is showing rulcode.com — Two Pointers Visualizer & Solution | Rulcode

Fetching algorithms...

    Two Pointers Visualizer & Solution | Rulcode
    Loading problem details...

    1. Two Pointers

    Easy
    Topics
    Companies
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: nums = [2, 7, 11, 15], target = 9
    Output: [0, 1]
    Explanation: The numbers at indices 0 and 1 (2 and 7) add up to 9.

    Example 2:

    Input: nums = [2, 7, 11, 15], target = 10
    Output: [-1, -1]
    Explanation: No two numbers in the array add up to 10.

    Example 3:

    Input: nums = [3, 3], target = 6
    Output: [0, 1]
    Explanation: The numbers at indices 0 and 1 (3 and 3) add up to 6.

    Example 4:

    Input: nums = [-1,0], target = -1
    Output: [0, 1]
    Explanation: The numbers at indices 0 and 1 (-1 and 0) add up to -1.

    Example 5:

    Input: nums = [5], target = 5
    Output: [-1, -1]
    Explanation: Needs 2 numbers to sum to target.

    Constraints:

    • •

    Time Complexity

    O(n)

    Space Complexity

    O(1)

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.