classSolution:deffindCelebrity(self,n:int) ->int: candidate =0for i inrange(1, n):# If the candidate knows person i, then switch candidate to iifknows(candidate, i): candidate = ifor i inrange(n):if candidate != i:ifknows(candidate, i)ornotknows(i, candidate):return-1return candidate