This question can be solved using graphs (indegree and outdegree concept) in O(N^2) Time complexity.
We can also solve this question in O(N) time and O(1) space using a simple two-pointer concept. We are going to compare two persons at a time one from beginning and other from the end and we will remove that person from consideration which cannot be a celebrity. For example, if there are two persons X and Y and X can identify person Y then surely X cannot be a celebrity as it knows a person inside this party. Another case would be when X does not know Y and in this case, Y cannot be a celebrity as there is at least one person who does not know him/her inside a party. Using this intuition two-pointer concept can be applied to find the celebrity inside this party.
I found a good explanatory video on Youtube by algods.
You can refer to this video for a better explanation.
Video Link: