FastPrepMove a Package through Overlapping Crane Reaches
Problems/Move a Package through Overlapping Crane Reaches

Move a Package through Overlapping Crane Reaches

Marshall Wace logoMarshall Wace● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report supplies the closed-reach movement rules, interface, one complete test and a generic reach illustration, but omits full bounds. This practice version uses explicit finite limits and an already-at-destination convention; it matches at about 90%.

A road starts at position zero. Crane i is fixed at position P[i] and has arm length A[i]. It can pick up a package at any position from P[i] - A[i] through P[i] + A[i], including both ends, and move it to any other position in that interval.

The package starts at B and must reach E. You may use any subset of the cranes and may reuse any crane any number of times. Return whether the package can reach its destination.

For this exercise, assume that when B = E, the answer is true without moving the package, even if no crane covers that position.

Function

solution(A: int[], P: int[], B: int, E: int) → boolean

Examples

Example 1

A = [2,1]P = [5,1]B = 3E = 6return = true

Crane zero reaches positions 3 through 7 and can move the package directly from 3 to 6.

Example 2

A = [3]P = [5]B = 2E = 8return = true

A crane at position 5 with arm length 3 reaches every position from 2 through 8, including both boundaries. This example uses those two endpoints.

Example 3

A = [2,2]P = [2,6]B = 0E = 8return = true

This example has reaches [0,4] and [4,8]. Transfer the package at the shared endpoint 4.

Constraints

  • For this exercise, assume 1 <= A.length = P.length <= 100000.
  • For this exercise, assume 0 <= A[i], P[i], B, E <= 10^9.
  • Cranes stay at their fixed positions. Reaches that touch at an endpoint allow a handoff there.

More Marshall Wace Online Assessment questions

  • Count Letters with Ordered Lowercase and Uppercase OccurrencesOA · Seen Oct 2025
  • Maximum Trailing Zeros on a Path with at Most One TurnOA · Seen Oct 2025
  • Shortest Subarray Covering an Integer RangeOA · Seen Oct 2025
  • Maximum Events in a 60-Second WindowOA · Seen Aug 2025
  • Successful Logins from Multiple CountriesOA · Seen Aug 2025
  • Maximize Remaining Item Types After Clearing Consecutive ShelvesOA · Seen Nov 2024
  • Shortest String After Erasing Equal PairsOA · Seen Nov 2024
  • Count Distinct Tags in a Fixed-Radius Circle (Practice Reconstruction)OA · Seen Apr 2024
  • Generate Unique Company Email AddressesOA · Seen Apr 2024
  • Reconstruct a Two-Row Binary MatrixOA · Seen Apr 2024

Similar questions at other companies

  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
  • Merge Overlapping IntervalsGoldman Sachs · OAGoldman Sachs interview questions
  • Track Received Byte RangesRoblox · OARoblox interview questions
  • Merge IntervalsBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Minimum Image Processing CostCitadel · OACitadel interview questions
  • Free Windows Between Busy IntervalsScale AI · OA · PHONE SCREENScale AI interview questions

Interview reports that mention this question

  • Marshall Wace Coding Tests: 11 Experiences (Part 2 of 3)
  • Marshall Wace Quant and Coding OA: 19 Experiences (Part 1 of 3)

Marshall Wace interview experiences

  • Marshall Wace Older Quant Tests: 5 Experiences (Part 3 of 3)
All Marshall Wace interview questionsSee Marshall Wace hiring insights
Saved
class Solution {
    public boolean solution(int[] A, int[] P, int B, int E) {
        // Write your solution here.
    }
}
Checking account…