Question bank › Graphs Dfs
Dsa Graphs Dfs Easy

Friend Circles

You are given a 2D array representing the relationship between friends. A '1' means friends and '0' means not friends. Your task is to count the number of distinct friend circles. A friend circle is a group of friends, either directly or indirectly connected. Return the number of friend circles. Input: 3 110 101 110 Output: 1

Key concepts

graphsdfssocial network

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.