Celebrity Problem

easy
  1. You are given a number n, representing the number of people in a party.
2. You are given n strings of n length containing 0's and 1's
3. If there is a '1' in ith row, jth spot, then person i knows about person j.
4. A celebrity is defined as somebody who knows no other person than himself but everybody else knows him.
5. If there is a celebrity print it's index otherwise print "none".

Note -> There can be only one celebrity. Think why?

                               
                               

Input Format

Input is managed for you

Output Format

Index of celebrity or none

Constraints

1 <= n <= 10^4
e1, e2, .. n * n elements belongs to the set (0, 1)

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
0000
1011
1101
1110
Output
0
Previous
Prefix Evaluation And Conversions
Next
Merge Overlapping Interval

Related Questions