← Questions

Truncate model output at the first stop sequence

0
PerplexityMicrosoft AIMicrosoftCodingLast asked Mar 2026

A coding interview question asked in Microsoft's coding round and at Perplexity and Microsoft AI, last asked Mar 2026. It tests strings, streaming and aho-corasick.

Implement a function that returns the part of a string that comes before the earliest stop word. Example 2.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Microsoft · Coding · Last asked Mar 202660 min · Ten to fifteen minutes of behavioral questions, then coding in HackerRank where you write a main and make the tests pass; usually three rounds · No AI unless the interviewer invites it; some 2026 loops add a round where you bring your own AI agent
  • Perplexity · Technical screen or assessment · Last asked Oct 2025Online assessment or live coding (often CoderPad); problems come in parts, each adding a requirement to your code · Assume no AI unless the recruiter says otherwise
  • Microsoft AI · CodingLive coding

What it tests

strings · streaming · aho-corasick

Your code and the AI tutor open when you unlock this question.