FastPrepLLM SDK Output Strategies
Problems/LLM SDK Output Strategies

LLM SDK Output Strategies

Apple logoApple● EasyNEW GRADPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes two subclasses but omits the exact interface, spacing and batch format. The judged core task matches the source at about 80%.

Build a small output SDK with a base output strategy and two implementations. The LLM is already running elsewhere; no network calls, URL sessions, or error-handling wrapper are needed.

  • The hello strategy returns hello and ignores its input.
  • The world strategy returns its input followed immediately by world, with no extra space.

For each matching pair in modes and inputs, invoke that strategy and return its output in batch order. Use subclasses where the language supports them, or implementations of a common interface in Go. Keep output behavior separate from any session object.

Function

sdkOutputs(modes: String[], inputs: String[]) → String[]

Examples

Example 1

modes = ["hello","world","world"]inputs = ["ignored","hi",""]return = ["hello","hiworld","world"]

The hello strategy ignores its input. The world strategy appends world directly, including for an empty input.

Example 2

modes = []inputs = []return = []

An empty batch has no outputs.

Constraints

  • 0 <= modes.length, inputs.length <= 1000
  • modes.length == inputs.length
  • Every mode is either hello or world.
  • Each input contains at most 1000 ASCII characters.

More Apple problems

  • Evaluate DivisionPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Validate a BST with a Custom ComparisonPHONE SCREEN · Seen Nov 2026
All Apple interview questionsSee Apple hiring insights
Saved
public String[] sdkOutputs(String[] modes, String[] inputs) {
    // Write your code here.
}
Checking account…