You're given a list of arbitrary jobs that need to be completed. These jobs are in form of distinct integer numbers. You're also given a list of dependencies.A dependency is represented as a pair of job where the first job is a prerequisite of second job i.e. the second job is dependent on first one, it can only be completed once the first job is completed .
Write a function that takes a list of jobs and list of dependencies and return a list containing a valid order in which jobs are completed if no such order exists then function should return an empty array.
You're given a list of arbitrary jobs that need to be completed. These jobs are in form of distinct integer numbers. You're also given a list of dependencies.A dependency is represented as a pair of job where the first job is a prerequisite of second job i.e. the second job is dependent on first one, it can only be completed once the first job is completed .
Write a function that takes a list of jobs and list of dependencies and return a list containing a valid order in which jobs are completed if no such order exists then function should return an empty array.
Jobs : [1,2,3,4] deps : [ [1,2] , [1,3] , [3,2] , [4,2] , [4,3] ]