Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
#include using namespace std;int main(int argc, char* argv[]){ unsigned int counter = 0, most_freq, n; while (cin >> n && n > 0) if (!counter) counter++, most_freq = n; else counter += (n == most_freq) ? +1 : -1; cout << most_freq << endl;}
#include
ReplyDeleteusing namespace std;
int main(int argc, char* argv[])
{
unsigned int counter = 0, most_freq, n;
while (cin >> n && n > 0)
if (!counter)
counter++, most_freq = n;
else
counter += (n == most_freq) ? +1 : -1;
cout << most_freq << endl;
}