| 1 | int 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 |
nothing calls this directly
no outgoing calls
no test coverage detected