how to nested dictonary that condition

Solutions on MaxInterview for how to nested dictonary that condition by the best coders in the world