I got this question in OA of Grab.
Can someone have any idea , how to solve this? I tried using indegree, outdegree but that didn't work.