Get Minimum Time for DNS Resolution (for Data Science Developer)

Problem Overview

  • Simulate DNS resolution with a cache that stores the cache_size most recent requests, and compute the minimum time per URL using cache_time or server_time.
  • Input: cache_size, cache_time, server_time, and an array of urls; Output: an int array giving time per request.
  • Constraints: 1 ≤ n ≤ 1e5, 1 ≤ cache_size ≤ 1e5, 1 ≤ cache_time, server_time ≤ 1e9, url length ≤ 20.
  • Real-world context: browser DNS caching and lookups; a coding interview problem and interview question from Ibm interviews.

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: