Google-Developer-Student-Club-CCOEW / Competitive-Coding

7 stars 51 forks source link

Question 80 #192

Open Mahi1901 opened 2 years ago

Mahi1901 commented 2 years ago

You are given an undirected graph with N nodes (numbered 1 through N). For each valid i, the i-th node has a weight Wi . Also, for each pair of nodes i and j, there is an edge connecting these nodes if (j - i) !=(Wj - Wi). Find the number of connected components in this graph.

Input Format The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single integer N. The second line contains N space-separated integers W1, W2,…,WN. Output Format For each test case, print a single line containing one integer --- the number of connected components in the graph.

Constraints 1≤T≤10^4 1≤N≤10^5 |Wi|≤10^9 for each valid i the sum of N over all test cases does not exceed 2⋅10^5.

Sample 1: Input 2 2 1 2 2 2 1 Output 2 1

NikitaMiraje commented 2 years ago

Nikita Miraje CCOEW E&TC I will like to work on this issue....Can you assign this to me?

shreya2208 commented 2 years ago

Shreya Amritkar Cummins College of Engineering for Women, Pune Dept- Information Technology 3rd year I would like to work on this issue, can u pls assign it to me?

Mahi1901 commented 2 years ago

I have assigned. Happy coding!

aditi3004 commented 2 years ago

HEY!!! This is Aditi Sharma(SY-C) MKSSS's CCOEW Computer Engineering

I want to work on this issue Can you assign this to me?

Git-Akshat01 commented 2 years ago

Hi! @JMukta25 Can you please assign me this task. I am Akshat Tiwari of BIT Raipur from Computer Science Engineering Branch.

utkarshaskumbhar commented 2 years ago

Hii I am utkarsha from CCOEW sy comp I want to work on this issue

siddhesh-coder commented 2 years ago

college: Dr.D.Y.Patil Institute of Engineering & Technology Ambi name: Siddhesh Bhosale Branch: computer Engineering year: BE Final Year