Skip to main content

Posts

Showing posts from July, 2021

array-rotation-to-left-by-given-distance-d

array-rotation-to-left-by-given-distance-d Array left rotation by a given number d Array left rotation by a given number d Step 1: Take two pointers 1. i = 0 2. j = arr[length] Step 2: 1. Swap index of all elements from i to d. 2. Swap index of all elements from d+1 to arr[length]. Step 3: Swap index of all elements from i to arr[length].