Determine feasible task ordering | Adobe Interview Question