Question: 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 = N
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
