Algorithm · Airtable · Medium
Given a collection of BUILD files and the relationships between them, produce an ordering in which every file is built only after the files it depends on. Input An integer n denoting the total number of BUILD files. A two-dimensional array dependencies, where each pair dependencies[i] = [a, b] means BUILD file a requires BUILD file b to be built first. Output Return an array containing a valid build sequence. If no valid sequence can be produced, return an empty array.…