rcount [ i ] [ j ] : Stores the count of i on right of index j
let rcount = new Array ( maxN ) ; for ( let i = 0 ; i < maxN ; i ++ ) { lcount [ i ] = new Array ( maxN ) ; rcount [ i ] = new Array ( maxN ) ; for ( let j = 0 ; j < maxN ; j ++ ) { lcount [ i ] [ j ] = 0 ; rcount [ i ] [ j ] = 0 ; } }