Used to store cumulative sum
let left = Array . from ( { length : n } , ( _ , i ) => 0 ) ; let right = Array . from ( { length : n } , ( _ , i ) => 0 ) ; let res = Array . from ( { length : n } , ( _ , i ) => 0 ) ;