FastPrepBounded HTTP Retry Flow
Problems/Bounded HTTP Retry Flow

Bounded HTTP Retry Flow

Benchling logoBenchling● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Benchling full-time phone screen. The report is about POST, GET, and retries over an unreliable satellite connection. Our response simulation is about 55% the same as the reported question. We chose the response kinds, the order of the phases, the limit on attempts, and what counts as success.

Return true if a client completes one POST request and then one GET request over an unreliable connection, using recorded responses. Otherwise return false.

postResponses and getResponses hold the responses that the attempts of each method get, in order, starting at index zero.

  • A response from 200 through 299 is a success.
  • A response of 0 is a transport failure. Retry it, and also retry HTTP 429 and any response from 500 through 599.
  • Any other response is a permanent failure.

Each method gets at most maxAttempts attempts, counting the first one. Stop a method as soon as it succeeds or fails permanently. If it runs out of attempts or recorded responses before it succeeds, it fails. Start GET only after POST succeeds, with a fresh attempt budget.

Note: you only replay the recorded responses. There are no real network calls, delays, or server side effects, and retrying POST is allowed.

Function

httpRetryFlow(postResponses: int[], getResponses: int[], maxAttempts: int) → boolean

Examples

Example 1

postResponses = [0,201]getResponses = [503,200]maxAttempts = 2return = true

POST gets a transport failure first, then succeeds on its second attempt. GET starts with a fresh budget and also succeeds on its second attempt, so the answer is true.

Example 2

postResponses = [400,201]getResponses = [200]maxAttempts = 2return = false

HTTP 400 is a permanent failure, so POST stops and the later success is never used. GET never starts, so the answer is false.

Constraints

  • 0 <= postResponses.length, getResponses.length <= 1000
  • Each recorded response is 0 or an integer from 100 through 599.
  • 1 <= maxAttempts <= 100

More Benchling interview questions

  • Future-Aware Cache EvictionPHONE SCREEN · Seen Aug 2025
  • Generate All Contiguous Protein ChainsPHONE SCREEN · Seen Jul 2024
  • Eight-Direction Keyboard Typing TimePHONE SCREEN · Seen Apr 2022
  • Generate Proteins from Contiguous Named SequencesPHONE SCREEN · Seen Aug 2021
  • Next Palindrome NumberPHONE SCREEN · Seen Jul 2021
  • Apply Overlapping HTML Formatting RangesPHONE SCREEN · Seen Feb 2019
  • Validate Nested JSON Against a SchemaONSITE INTERVIEW · Seen Dec 2025
  • Degenerate DNA Substring SearchONSITE INTERVIEW · Seen Jun 2024
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Jul 2021
  • 2048 Move SimulatorOA · Seen Feb 2019

Similar questions at other companies

  • Lazy Filter over a GeneratorSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Array-Backed Set Without Library CollectionsOde with Anthropic · PHONE SCREEN
  • Paginate Retained Conversation HistorySierra · PHONE SCREENSierra interview questions
  • Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
  • Count Distinct Underwriting PII ValuesAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
  • Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Bounded IPv4 FilterAmazon · PHONE SCREEN
All Benchling interview questionsSee Benchling hiring insights
Saved
class Solution {
    public boolean httpRetryFlow(int[] postResponses, int[] getResponses, int maxAttempts) {
        // Write your code here.
    }
}
Checking account…