Traverse an Up-Down-Right Pointer Structure
Updated
Problem statement
Node i has value values[i] and up, down, and right target indices or -1. Starting at start, follow any of those directed pointers. Return every reachable node value once in ascending order.
Function
accessibleValues(values: int[], up: int[], down: int[], right: int[], start: int) → int[]Examples
Example 1
values = [1,2,3,4,5,6,7,8,9,10,11,12]up = [-1,0,1,-1,-1,-1,-1,6,-1,-1,9,-1]down = [-1,-1,3,-1,5,-1,-1,8,-1,-1,-1,-1]right = [-1,-1,4,-1,7,-1,-1,10,-1,-1,11,-1]start = 2return = [1,2,3,4,5,6,7,8,9,10,11,12]Starting at value 3 reaches every displayed node.
Constraints
- All arrays have equal length.
- The reachable pointer graph is acyclic.
More Bloomberg LP Phone Screen questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Top-Rated Similar MoviesGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Aggregate Machine TopologyOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Deterministic Depth-First Graph TraversalWaymo · PHONE SCREENWaymo interview questions
- Module Rebuild CostsAirbnb · OAAirbnb interview questions
- Priority Graph: First Arrival TimesIntuit · OAIntuit interview questions
- Reconstruct ItineraryTripjack · ONSITE INTERVIEWTripjack interview questions
- Evolving Merchant Clusters and Persistent PinsStripe · OAStripe interview questions
- Create Lexicographically Largest PermutationOracle · OAOracle interview questions
- Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Mutual-Friend Referral RecommendationsFireworks AI · PHONE SCREEN · ONSITE INTERVIEW
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)