G - Yet Another mod M Editorial by rsk0315


過半数を求めるパートを(\(A\) の値によらず)\(O(n)\) 時間で行う方法を紹介します。

Boyer–Moore majority voting algorithm というのが存在します。

posted:
last update: