FastPrepDelimiter-Parsing String Iterator
Problems/Delimiter-Parsing String Iterator

Delimiter-Parsing String Iterator

amo logoamo● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an amo full-time phone screen. The report describes a custom parser and iterator for strings with delimiters. We chose the exact matching rule and what to do with empty pieces. Our version is about 83% the same as the reported question.

Split text at every exact occurrence of the nonempty delimiter and return the fragments in iterator order.

Preserve empty fragments at the beginning, end, or between adjacent delimiters.

Function

iterateFragments(text: String, delimiter: String) → String[]

Examples

Example 1

text = "a::b::::c::"delimiter = "::"return = ["a","b","","c",""]

Adjacent and trailing delimiters preserve empty fragments.

Example 2

text = "abc"delimiter = "|"return = ["abc"]

No delimiter yields one fragment.

Constraints

  • 0 <= text.length <= 100000.
  • 1 <= delimiter.length <= 100.

Source note: Author-written prompt excerpt retained for source fidelity.

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Format a Signed Integer with CommasHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Run-Length DecodingApple · PHONE SCREENApple interview questions
  • Trace Pointer Rebinding and Pointee UpdatesArista Networks · PHONE SCREENArista Networks interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Decode and Store StringsAirbnb · PHONE SCREENAirbnb interview questions
  • SimpleRDD Word CountDatologyAI · PHONE SCREEN
See amo hiring insights
Saved
class Solution {
    public String[] iterateFragments(String text, String delimiter) {
        // Write your code here.
    }
}
Checking account…