You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )
std::string balancedSums(std::vector<int> _v) { size_t sumAll = 0; size_t sumLeft = 0; std::for_each( _v.cbegin(), _v.cend(), [&](auto & num){sumAll += num;} ); for(auto & num : _v){ if( sumLeft == (sumAll -= num)){ return "YES"; } sumLeft += num; } return "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )