Trains the technique from
LeetCode 207Course ScheduleThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A trade academy signs off apprentices on skillCount skills, labelled 0 through skillCount - 1. An apprentice attempts one skill at a time and must respect the academy's gating rules.
You are given requirements, where requirements[i] = [skill, gate] means the assessor will not let anyone attempt skill until gate has already been signed off. A skill that gates itself can therefore never be attempted. Only feasibility matters here — you are not asked which order to use.
Return true when at least one attempt order signs off the whole catalogue, and false when no order does.
Example 1
Skill 0 opens both skill 1 and skill 2, and once those two are signed off skill 3 becomes available, so the whole catalogue clears.
Example 2
Each of the two skills gates the other, so neither can ever be the first attempt.
Example 3
The catalogue splits into three unrelated pairs, and each pair is cleared by taking the gate before the skill it guards.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def plan_is_feasible(skillCount: int, requirements: list[list[int]]) -> bool:public boolean planIsFeasible(int skillCount, int[][] requirements)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.