Sanjaay Gowda T S
Deutsche Telekom AG practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Search a sorted service-range table

Software engineeringMediumConcept

Original practice scenario inspired by Deutsche Telekom AG's public business context; this is not a reported interview question or a description of its internal systems. A synthetic coverage checker stores nonoverlapping sorted integer address ranges with a service label. Explain a logarithmic lookup for an address, and how you would test gaps and exact endpoints.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Binary-search for the range with the greatest start not exceeding the address, then verify that the address is within that range's end. Finding a predecessor alone does not prove coverage.

Work through it

  1. Specify inclusive or half-open endpoints and validate sorted, nonoverlapping ranges when loading configuration. Reject ambiguous overlaps rather than selecting an arbitrary service.
  2. Use a half-open search over starts to locate the first start greater than the address, then inspect its predecessor if one exists.
  3. Test empty configuration, an address before the first range, both boundaries, an internal gap, and an address after the final range. Include a single-address range.

Tradeoffs to discuss

  • Static sorted arrays offer compact logarithmic reads; frequent range updates may favor an ordered structure with stronger update support.

Common pitfalls

  • Returning the predecessor label without checking its end incorrectly fills coverage gaps.
  • Mixing endpoint conventions creates off-by-one errors at neighboring ranges.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub