Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need solution in Python 2 Friend Circles There are N students in a class. Some of them are friends, while some are notTheir friendship is
need solution in Python 2
Friend Circles There are N students in a class. Some of them are friends, while some are notTheir friendship is transitive in nature, i.e, ifA is friend of B and B is friend of C, then a is also friend of C. A friend circle is a group of students who are directly or indirectly friends. You have to complete a function int friendCircles(charIO friends) which returns the number of friend circles in the class. Its argument, friends, is a NxN matrix which consists of characters 'Y' or 'N'. If friends[i) = "Y, then ph and th students are friends with each other, otherwise not. You have to return the total number of friend circles in the class. Note: The method signature will differ by language. For example, Java will have int friendCircles(String) friends)where "friends" is an array of strings, which can be viewed as a 2-dimensional array of characters. Constraints 1 = NStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started