Get Minimum Time for DNS Resolution

Problem Overview

  • Simulate DNS resolution with a finite cache to compute the minimum time for each URL request.
  • Input: cache_size, cache_time, server_time, and URLs array (n up to 1e5); Output: per-request times array.
  • Cache starts empty and holds up to cache_size most recent URL-IP mappings; resolving from cache costs cache_time, from server costs server_time.
  • Real-world context: browser DNS cache vs server lookups.
  • From Walleye interviews; a DNS problem often used as a coding interview interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: