Two global variables live in two different .cpp files. What is their initialization order at run time, and what is their destruction order?
Asked in the technical phone screen stage. Initialization order across translation units is undefined, and destruction happens in reverse order of construction. Implement a function that reports these rules for an observed construction order.
construction_order is a list of distinct global-variable names in the order they were constructed at run time. Return a dictionary with initialization_order set to "undefined across translation units" and destruction_order containing the names in reverse construction order.
def global_lifetime_order(construction_order):