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 — Segment Tree Visualizer & Solution | Rulcode

Fetching algorithms...

    Segment Tree Visualizer & Solution | Rulcode
    Loading problem details...

    57. Segment Tree

    Hard
    Topics
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: nums = [1, 3, 5, 7, 9, 11], left = 1, right = 4
    Output: 24
    Explanation: The sum of nums[1] + nums[2] + nums[3] + nums[4] = 3 + 5 + 7 + 9 = 24

    Example 2:

    Input: nums = [1, 2, 3], left = 0, right = 2
    Output: 6
    Explanation: The sum of nums[0] + nums[1] + nums[2] = 1 + 2 + 3 = 6

    Example 3:

    Input: nums = [-2, 0, 3, -5, 2, -1], left = 0, right = 5
    Output: -3
    Explanation: The sum is -2 + 0 + 3 + (-5) + 2 + (-1) = -3

    Constraints:

    • •
    • •
    • •

    Time Complexity

    O(log n)

    Space Complexity

    O(n)

    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.