Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Deploy Configs Across Namespaces

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Deploy Configs Across Namespaces. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given a configuration payload represented as a JSON string and a list of Kubernetes namespace names, write a function that returns an ordered deployment plan. Each config object contains name, version, and content. For every namespace, include one deployment action per unique (name, version) pair, keeping only the last occurrence from the input JSON while preserving the final effective order.

Constraints

  • 1 <= len(namespaces) <= 10^3
  • 0 <= number of config objects <= 10^4
  • Each config object contains string fields name, version, and content
  • Namespace names are non-empty strings
  • Invalid JSON or malformed config objects should raise ValueError

Function Signature

def build_deployment_plan(namespaces, config_json):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output