HackerEarth Maximum Sum of Building Speed problem solution YASH PAL, 31 July 2024 In this HackerEarth Maximum Sum of Building Speed problem solution You are the king of Pensville where you have 2N workers. All workers will be grouped in association of size 2,so a total of N associations have to be formed. The building speed of the ith worker is A. To make an association, you pick up 2 workers. Let the minimum building speed between both workers be x, then the association has the resultant building speed x. You have to print the maximum value possible of the sum of building speeds of N associations if you make the associations optimally. HackerEarth Maximum Sum of Building Speed problem solution. #include <bits/stdc++.h> using namespace std; int a[301]; int main () { int n, m; cin >> m; n = m * 2; for (int i = 1;i <= n;i ++) { cin >> a[i]; } sort (a + 1, a + n + 1 ); int ans = 0; for (int i = 1;i <= n;i += 2) { ans += min (a[i], a[i + 1]); } cout << ans; return 0;} coding problems