Find total sum and frequencies of elements
#include <bits/stdc++.h> NEW_LINE using namespace std ; int maxSumArray ( int arr [ ] , int n ) { int sum = 0 ; unordered_map < int , int > mp ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; mp [ arr [ i ] ] ++ ; }