LeetCode
Online Majority Element In Subarray
Click
here
for an explanation.