We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Arrays: Left Rotation
- Discussions
Arrays: Left Rotation
Arrays: Left Rotation
Sort by
recency
|
4944 Discussions
|
Please Login in order to post a comment
Rust
My solution: ` def rotLeft(a, d): a = reverse(0,d-1,a) a = reverse(d,len(a)-1,a) a = reverse(0,len(a)-1,a) return a
def reverse(s,e,arr): i = s j = e while i < j: temp = arr[i] arr[i] = arr[j] arr[j] = temp i+=1 j-=1 return arr `
C++