Added shift array in O(n) no space