Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #85 from AIOCodeBase/to-be-merged
Browse files Browse the repository at this point in the history
Create README.md
  • Loading branch information
ImSaMPro committed Nov 5, 2022
2 parents cc156a6 + 1047657 commit 5c93050
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions 05 November 2022/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Grouping Of Numbers

**Medium**

One day Jim came across array **arr\[\]** of **N** numbers. He decided to divide these **N** numbers into different groups. Each group contains numbers in which sum of any two numbers should **not be divisible** by an integer **K**. Print the size of the group containing **maximum** numbers.

**Example 1:**

```
Input:
N = 4, K = 8
arr[] = {1, 7, 2, 6}
Output:
2
Explanation:
The group of numbers which can be formed
are: (1),(2),(7),(6),(1,2),(1,6),(7,2),(7,6).
So,the maximum possible size of the group is 2.
```

**Example 2:**

```
Input:
N = 2, K = 3
arr[] = {1, 2}
Output:
1
Explanation:
The group of numbers which can be formed
are: (1),(2). So,the maximum possible size
of the group is 1.
```

**Your Task:**
You don't need to read input or print anything. Your task is to complete the function **maxGroupSize()** which takes 2 Integers N, and K and also an array arr\[\] of N integers as input and returns the maximum group size possible.

**Expected Time Complexity:** O(N)
**Expected Auxiliary Space:** O(K)

**Constraints:**
1 ≤ N,K,arr\[i\] ≤ 105

> ### Problem URL: **[Grouping Of Numbers](https://practice.geeksforgeeks.org/problems/grouping-of-numbers0015/1)**

0 comments on commit 5c93050

Please sign in to comment.