Celebrity Problem | Module : Basics Data Structures | In English | Python | Video_12

preview_player
Показать описание

NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Description:
This is a easy level and a very interesting question of topic stack and queues. Here, you have n numbers (from 0 to n-1). You have to find out who is the celebrity. The celebrity will be the person who knows noone but everyone knows him. If there is a celebrity, print that celebrity else print none.

Question Name:
Celebrity Problem

Question Link:

Question Statement:
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?

Topic: #Stacks #Stack #StackAndQueue #CelebrityProblem

Used #DataStructure: #Stacks #Arrays

#TimeComplexity: O(N)

#SpaceComplexity: O(N) (Stack Space)

---------------------------------------------------------------

More Youtube PlayList:

---------------------------------------------------------------

Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.



We also provide professional courses with live classes and placement opportunities.

.

.

.

Happy Programming !!! Pep it up

----------------------------------------------------------------

#Stacks #Stack #StackAndQueue #Celebrity #CelebrityProblem
join shbcf.ru