Your question is Collaborative Coding With Tests. 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.
During a collaborative coding session for VMware Tanzu, the interviewer may add deployment scenarios as test cases while you implement the scheduling logic. Given a set of services and dependency relationships, return the order in which the services can be deployed.
Each dependency is represented as [service, prerequisite], meaning prerequisite must be deployed before service. If multiple services are currently available, choose the lexicographically smallest service name. If the dependencies contain a cycle, return an empty list because no valid deployment order exists.
Implement deployment_order(services, dependencies).
services is a list of unique strings.dependencies is a list of two-element lists of strings.[] if no such order exists.def deployment_order(services, dependencies):