LG Electronics Off-Campus OA (2021) | Find the Town Judge Problem
Question · Posted Jun 2026
Problem Statement In a town of n people labeled from 1 to n, there is a rumor that one person is secretly the judge. The judge: Trusts nobody. Is trusted by every other person. You are given an array trust where trust[i] = [a, b] means person a trusts person b. Return the label of the town judge if one exists; otherwise return -1. Example Input n = 3 trust = [[1,3],[2,3]] Output 3
The full answer & interview discussion are available to premium members.
Log in Create a free account