3310. Remove Methods From Project
You are maintaining a project that has
n
methods numbered from0
ton - 1
.You are given two integers
n
andk
, and a 2D integer arrayinvocations
, whereinvocations[i] = [ai, bi]
indicates that methodai
invokes methodbi
.There is a known bug in method
k
. Methodk
, along with any method invoked by it, either directly or indirectly, are considered suspicious and we aim to remove them.A group of methods can only be removed if no method outside the group invokes any methods within it.
Return an array containing all the remaining methods after removing all the suspicious methods. You may return the answer in any order. If it is not possible to remove all the suspicious methods, none should be removed.