Write a function that takes in a course we want to avoid and a list of courses and their prerequisites, and returns how many courses we can take before the course we want to avoid.// Do not remove these imports. You may add others if you wish.import java.io.*;import java.util.*;public class Solution {// If you need extra classes, you can define them privately here within class Solution/*Args:disliked: a String, the course you want to avoid takingprereqs: a String[][]. each String[] is a course pairThe first course must be taken before the second can be takenex: {{"Algos", "AI"}, ...} -> Take Algos before taking AIReturns:a String, the number of courses you can take before taking dislikeddirected and unweighted graph i think