Marketo OA 分享


上周投的Marketo,过了一会就回复我了,问了一下GPA,(我GPA很低)。 然后发OA,hackrank。

不过他是回帖着,只能一个一个发。。我在这里贴一下把,并且有一题补充:friend circles 也在附件里了。

对于friend circle,我最后10个case只过了4个,不知道什么问题。这样估计就跪了。大家帮我看一下有什么问题呗,谢谢。friend circles的原题这里有: … nges/friend-circles

Problem Statement
There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature, i.e., if A 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 are given a N×N−matrix M which consists of characters Y or N. If M[j]=Y, then ith and jth students are friends with each other, otherwise not. You have to print the total number of friend circles in the class.Input Format
First line of the input contains an integer N – (size of the matrix), followed by N lines each having N characters.Output Format
Print the maximum number of friend circles.Constraints
Each element of matrix friends will be Y or N.
Number of rows and columns will be equal in the matrix.M=Y, where 0≤i