Predict Runtime Method Dispatch
Updated
Problem statement
A base type defines label() as base, and a derived type overrides it as derived. Each entry in runtimeTypes is B or D and is stored behind a base-typed reference.
Return the output of calling label() for every object in order. Calls use runtime dispatch.
Function
dispatchLabels(runtimeTypes: String[]) → String[]Examples
Example 1
runtimeTypes = ["B","D","D"]return = ["base","derived","derived"]The runtime object decides which override runs.
Example 2
runtimeTypes = []return = []No calls produce no output.
Constraints
0 <= runtimeTypes.length <= 100000.- Every entry is
BorD.
Source note: Author-written prompt excerpt retained for source fidelity.
More AMD Onsite Interview questions
- Insert After a Linked-List NodeONSITE INTERVIEW · Seen Oct 2026
- LRU CacheONSITE INTERVIEW · Seen Oct 2026
- Sort a Binary ArrayONSITE INTERVIEW · Seen Oct 2026
- K Largest Elements with QuickselectONSITE INTERVIEW · Seen Sep 2026
- Climbing StairsONSITE INTERVIEW · Seen Sep 2026
- First-Fit Arena AllocatorPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Minimum Coins for an AmountONSITE INTERVIEW · Seen Sep 2026
- Growing Circular QueueONSITE INTERVIEW · Seen Feb 2026
- Parse a Binary Firmware HeaderONSITE INTERVIEW · Seen Feb 2026
- Matrix Multiplication and Parallel PartitionsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
Similar questions at other companies
- Card Transaction StreamCapital One · ONSITE INTERVIEWCapital One interview questions
- File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- Stateful Log Transform and SearchRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- Query JSON Records with WHERE and ORDER BYGitHub · ONSITE INTERVIEW
- Code Editor FoldingJane Street · ONSITE INTERVIEWJane Street interview questions
- Path Leaf Character IteratorGoogle · ONSITE INTERVIEWGoogle interview questions
- Hybrid Run-Length and Bit-Packing EncoderDatabricks · ONSITE INTERVIEWDatabricks interview questions
- Feature Flag Evaluation EngineCresta · ONSITE INTERVIEWCresta interview questions
- Text Document HistoryNotion · PHONE SCREEN · ONSITE INTERVIEWNotion interview questions
Interview reports that mention this question
AMD interview experiences
- AMD GPU and Verification Interviews: 3 Experiences (Part 3 of 3)
- AMD SDE2 and AI Engineer Interviews: 7 Experiences (Part 2 of 3)
- AMD New Grad Role Interviews: 3 Experiences (Part 2 of 2)
- AMD ML and GPU Intern Interviews: 7 Experiences (Part 2 of 2)
- AMD Experienced SWE Interviews: 6 Experiences (Part 1 of 3)