Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago

Question

=+5 Does this case provide an example of the future for IHRM?

Answered: 1 week ago