TensorTonicTensorTonic
Problems
Study PlansProjectsNewInterviewPricingFeedback
Problems
Loading...
1 / 1

Model Versioning

MLOps
Easy

Select one model record for production using three ordered criteria: highest accuracy, then lowest latency, then latest ISO-format timestamp. Dates use YYYY-MM-DD, so their strings can be compared chronologically. Return only the selected model’s name.

Loading visualization...

Examples

Input: models = [{"name": "v1", "accuracy": 0.85, "latency": 120, "timestamp": "2024-01-15"}, {"name": "v2", "accuracy": 0.91, "latency": 95, "timestamp": "2024-02-20"}]

Output: "v2"

Explanation: Accuracy is the primary criterion, and v2 has the higher value.

Input: models = [{"name": "v1", "accuracy": 0.9, "latency": 100, "timestamp": "2024-01-10"}, {"name": "v2", "accuracy": 0.9, "latency": 80, "timestamp": "2024-03-05"}]

Output: "v2"

Hint 1

Maintain the best record while scanning the list once.

Hint 2

Compare accuracy first, then latency only on a tie, then timestamp only if both remain tied.

Requirements

  • Prefer higher accuracy before considering any tie-breaker
  • Break accuracy ties with lower latency
  • Break remaining ties with the latest timestamp
  • Return the selected model name as a string

Constraints

  • models is a nonempty list of dictionaries
  • Every record contains name, accuracy, latency, and timestamp
  • Model names are unique
  • Use Python only
Try Similar Problems
Shadow Deployment EvaluationRetraining Trigger DesignMonitoring Metrics SelectionFeature Store LookupData Drift Detection

Sign in to take notes on this problem

Case 1
Case 2

Accepts: array

You must run your code first.
PrevNext

Model Versioning

MLOps
Easy

Select one model record for production using three ordered criteria: highest accuracy, then lowest latency, then latest ISO-format timestamp. Dates use YYYY-MM-DD, so their strings can be compared chronologically. Return only the selected model’s name.

Loading visualization...

Examples

Input: models = [{"name": "v1", "accuracy": 0.85, "latency": 120, "timestamp": "2024-01-15"}, {"name": "v2", "accuracy": 0.91, "latency": 95, "timestamp": "2024-02-20"}]

Output: "v2"

Explanation: Accuracy is the primary criterion, and v2 has the higher value.

Input: models = [{"name": "v1", "accuracy": 0.9, "latency": 100, "timestamp": "2024-01-10"}, {"name": "v2", "accuracy": 0.9, "latency": 80, "timestamp": "2024-03-05"}]

Output: "v2"

Hint 1

Maintain the best record while scanning the list once.

Hint 2

Compare accuracy first, then latency only on a tie, then timestamp only if both remain tied.

Requirements

  • Prefer higher accuracy before considering any tie-breaker
  • Break accuracy ties with lower latency
  • Break remaining ties with the latest timestamp
  • Return the selected model name as a string

Constraints

  • models is a nonempty list of dictionaries
  • Every record contains name, accuracy, latency, and timestamp
  • Model names are unique
  • Use Python only
Try Similar Problems
Shadow Deployment EvaluationRetraining Trigger DesignMonitoring Metrics SelectionFeature Store LookupData Drift Detection

Sign in to take notes on this problem

Case 1
Case 2

Accepts: array

You must run your code first.