Validate Linked List Pointer Ordering
Updated
Problem statement
Arrays encode one singly linked list: next[i] is the next node index and head its first node. Every node is visited exactly once. Auxiliary backward[i] and forward[i] are node indices or -1 for null.
Return true if every non-null backward pointer targets an earlier list position and every non-null forward pointer targets a later position.
Function
validPointerOrder(next: int[], backward: int[], forward: int[], head: int) → booleanExamples
Example 1
next = [1,2,-1]backward = [-1,0,0]forward = [2,2,-1]head = 0return = trueAll auxiliary pointers point in their required list direction.
Constraints
- All arrays have equal length.
- All nonnegative indices are valid.
More Bloomberg LP Phone Screen questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE 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
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Meta Copy List with Random PointerMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Deep Copy a Random-Pointer ListSuperhuman · PHONE SCREENSuperhuman interview questions
- Remove All Repeated Values from a Linked ListArista Networks · PHONE SCREENArista Networks interview questions
- Deep Copy a Random-Pointer ListAmazon · ONSITE INTERVIEW
- Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
- Merchant Matching, Parts 1–2: Shared Fields and Weighted ThresholdsStripe · PHONE SCREENStripe interview questions
- Insert Delete GetRandom O(1)Charta Health · PHONE SCREENCharta Health interview questions
- Longest Consecutive SequenceKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
- Longest Consecutive SequenceJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
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)