FastPrepPredict Runtime Method Dispatch
Problems/Predict Runtime Method Dispatch

Predict Runtime Method Dispatch

AMD logoAMD● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an AMD full-time onsite interview. The report asks you to predict the output when a method is overridden. We chose the smallest setup that makes sense: two classes and a sequence of objects at run time. Our version is about 78% the same as the reported question.

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 B or D.

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 Interviews by Role, Level Not Reported: 9 Experiences

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)
All AMD interview questionsSee AMD hiring insights
Saved
class Solution {
    public String[] dispatchLabels(String[] runtimeTypes) {
        // Write your code here.
    }
}
Checking account…