} Driver Code Ends
| 10 | |
| 11 | // } Driver Code Ends |
| 12 | class Solution{ |
| 13 | public: |
| 14 | void reverse(int arr[], int start,int end){ |
| 15 | while(start<end){ |
| 16 | int temp = arr[start]; |
| 17 | arr[start] = arr[end]; |
| 18 | arr[end] = temp; |
| 19 | start++; |
| 20 | end--; |
| 21 | } |
| 22 | } |
| 23 | //Function to rotate an array by d elements in counter-clockwise direction. |
| 24 | void rotateArr(int arr[], int d, int n){ |
| 25 | |
| 26 | // code here |
| 27 | d=d%n; |
| 28 | reverse(arr,0,d-1); |
| 29 | reverse(arr,d,n-1); |
| 30 | reverse(arr,0,n-1); |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | // { Driver Code Starts. |
| 35 |
nothing calls this directly
no outgoing calls
no test coverage detected