Julia's 1st practice:
Study code is here.
Go over C# program a few lines of statements here:
var a = ReadToken().Select(ch=>"ACTG".IndexOf(ch)).ToArray();
Line 44 - 45:
for(int i = 0; i < 4; i++)
target[i] = Math.Max(0, a.Count(aa => aa == i) - n / 4);
Line 47 - 51:
if (target.All(t => t == 0))
Left, right two pointer (l, r), starting from 0
Declare a sum array
Start a loop, loop on r
Inside the first loop, another loop for left pointer – l
and compare to existing smallest length
C# code implementation to study, code is here.