dic = {0:-1} # dic record: count(the times we met 1 - the time we met 0) : idx count = 0 # lets say count == 3, it means until this idx, if 0 appeared x time, 1 appeared x+3 time res = 0 # So, once ...
"The journey of a thousand problems begins with a single solution." ...