You asked what for(m=k=0;k<n;m+=!(a[k++]-j)<<1)if(!m–)j=a[k]; does.
I have rewritten the code:
for(m=k=0;k<a.length;m+=~(a[k++]-j)<<1)
{
if(~m–)
j=a[k];
}
It looks like the code calculates the number of equal cells in a sorted array.
I mean, it goes from k = 0 to the length, and if m value is zero: j = a[k]
so when m+=!(a[k++]-j) << 1 the a[k++]-j is the substraction of the two values in the array. m increases when this equals 0
I don't know what << 1 mean, it is like * 2 but maybe it has a special use here
Please tell me if my guess was true
Thanks for reading, and sorry for the english. I don't know how to allign right here