Pinterest services may depend on other services before they can process requests. Given a directed dependency graph, determine whether the graph contains a cycle that could prevent a valid startup or deployment order.
Implement has_dependency_cycle(dependencies), where each dictionary key is a service and its value is a list of services it directly depends on. A directed edge from service to dependency means the service requires that dependency. Return True if any cycle exists, otherwise return False.
dependencies, a dictionary mapping strings to lists of strings.True when at least one directed cycle exists; otherwise return False.def has_dependency_cycle(dependencies):