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 — Binary Lifting Visualizer & Solution | Rulcode

Fetching algorithms...

    Binary Lifting Visualizer & Solution | Rulcode
    Loading problem details...

    65. Binary Lifting

    Hard
    Topics
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: graph = [[1, 2], [0], [0]], node = 1, k = 1
    Output: 0
    Explanation: The 1st ancestor of node 1 is node 0.

    Example 2:

    Input: graph = [[1, 2], [0, 3], [0], [1]], node1 = 3, node2 = 2
    Output: 0
    Explanation: The Lowest Common Ancestor of node 3 and node 2 is node 0.

    Example 3:

    Input: graph = [[],[0],[0],[1,6,7],[5],[4,10],[3,8,9],[3],[6],[6],[5,11],[10],[13],[12],[15],[14],[]], node = 11, k = 4
    Output: 0
    Explanation: The 4th ancestor of node 11 is node 0.

    Constraints:

    • •
    • •
    • •

    Time Complexity

    O(log n)

    Space Complexity

    O(n log n)

    Code Runner is not available for this problem.

    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.