Strings…
1 min readDec 10, 2019
927. Three Equal Parts
https://leetcode.com/contest/weekly-contest-107/problems/three-equal-parts/
Each part has to have the total number of ‘1’ // 3
from the beginning, we can get the final result without pending zeros.
from the end, we can get the pending zero information.
For example, if we have
000101001010000000000010100
from the beginning, we know we need 101
from the end, we know we need pending 00
So the final valid result will be ‘101’ + ‘00’
I give the name of ‘101’ as first and ‘00’ as pending_zero.
Look from end can get the valid part directly.
Thanks for reading.