MCPcopy Create free account
hub / github.com/Rohit91singh9/Coding-DP-DSA / minimumGroups

Function minimumGroups

minimumGroups.cpp:1–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1int minimumGroups(vector<int> awards, int k)
2{
3 sort(awards.begin(), awards.end());
4 int count = 1;
5 int flag = 0;
6 for (int i = 0; i < awards.size() - 1; i++)
7 {
8 for (int j = i + 1; j < awards.size(); j++)
9 {
10 if ((awards[j] - awards[i]) > k)
11 {
12 count++;
13 flag = 1;
14 i = j;
15 }
16 else
17 {
18 flag = 0;
19 }
20 }
21 }
22
23 return count;
24}
25
26/* This is complete logic of a Program in C++
27 Remaining codes are in-built

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected