From 65c99aacdebed625050fc83e0b7717eefff864f9 Mon Sep 17 00:00:00 2001 From: Priya Kumari <77202746+priyakumari02@users.noreply.github.com> Date: Sun, 24 Oct 2021 20:19:19 +0530 Subject: [PATCH 1/5] rotateArray c++ --- Arrays/rotateArray.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Arrays/rotateArray.cpp diff --git a/Arrays/rotateArray.cpp b/Arrays/rotateArray.cpp new file mode 100644 index 0000000..f349615 --- /dev/null +++ b/Arrays/rotateArray.cpp @@ -0,0 +1,59 @@ +#include +using namespace std; + + + // } Driver Code Ends +class Solution{ + public: + + //Function to rotate an array by d elements in counter-clockwise direction. + void rotateArr(int arr[], int d, int n){ + int temp[n]; + int j=0; + for(int i=d;i> t; + + while(t--){ + int n, d; + + //input n and d + cin >> n >> d; + + int arr[n]; + + //inserting elements in the array + for(int i = 0; i < n; i++){ + cin >> arr[i]; + } + Solution ob; + //calling rotateArr() function + ob.rotateArr(arr, d,n); + + //printing the elements of the array + for(int i =0;i Date: Sun, 24 Oct 2021 20:25:12 +0530 Subject: [PATCH 2/5] shortestPath.cpp --- Character_arrays/shortestPath.cpp | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Character_arrays/shortestPath.cpp diff --git a/Character_arrays/shortestPath.cpp b/Character_arrays/shortestPath.cpp new file mode 100644 index 0000000..c02409e --- /dev/null +++ b/Character_arrays/shortestPath.cpp @@ -0,0 +1,50 @@ +#include +using namespace std; +int main(){ +char direction[1000]; +cout<<"Enter the direction First letter"<=0 and y>=0){ + while(y--){ + cout<<'N'; + } + while(x--){ + cout<<'E'; + } +} +if(x<=0 and y>=0){ + while(y--){ + cout<<'N'; + } + while(x++){ + cout<<'W'; + } +} +if(x<=0 and y<=0){ + while(y++){ + cout<<'S'; + } + while(x++){ + cout<<'W'; + } +} +if(x>=0 and y<=0){ + while(y++){ + cout<<'S'; + } + while(x--){ + cout<<'E'; + } +} +return 0; +} \ No newline at end of file From e6da33b14f316f82b263e6358e57b1856ea1e3f2 Mon Sep 17 00:00:00 2001 From: Priya Kumari <77202746+priyakumari02@users.noreply.github.com> Date: Sun, 24 Oct 2021 20:50:49 +0530 Subject: [PATCH 3/5] shortestpath.cpp From 2d816b2199652861b1cb7b5b3c371a611e1a3465 Mon Sep 17 00:00:00 2001 From: Priya Kumari <77202746+priyakumari02@users.noreply.github.com> Date: Sun, 24 Oct 2021 20:54:27 +0530 Subject: [PATCH 4/5] Delete shortestPath.cpp --- Character_arrays/shortestPath.cpp | 50 ------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 Character_arrays/shortestPath.cpp diff --git a/Character_arrays/shortestPath.cpp b/Character_arrays/shortestPath.cpp deleted file mode 100644 index c02409e..0000000 --- a/Character_arrays/shortestPath.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -using namespace std; -int main(){ -char direction[1000]; -cout<<"Enter the direction First letter"<=0 and y>=0){ - while(y--){ - cout<<'N'; - } - while(x--){ - cout<<'E'; - } -} -if(x<=0 and y>=0){ - while(y--){ - cout<<'N'; - } - while(x++){ - cout<<'W'; - } -} -if(x<=0 and y<=0){ - while(y++){ - cout<<'S'; - } - while(x++){ - cout<<'W'; - } -} -if(x>=0 and y<=0){ - while(y++){ - cout<<'S'; - } - while(x--){ - cout<<'E'; - } -} -return 0; -} \ No newline at end of file From 9530084fe8e0787e83cd47a2cf00fbbbc5369521 Mon Sep 17 00:00:00 2001 From: Priya Kumari <77202746+priyakumari02@users.noreply.github.com> Date: Sun, 24 Oct 2021 20:55:24 +0530 Subject: [PATCH 5/5] shortestPathcpp --- Character_arrays/shortestPath.cpp | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Character_arrays/shortestPath.cpp diff --git a/Character_arrays/shortestPath.cpp b/Character_arrays/shortestPath.cpp new file mode 100644 index 0000000..c02409e --- /dev/null +++ b/Character_arrays/shortestPath.cpp @@ -0,0 +1,50 @@ +#include +using namespace std; +int main(){ +char direction[1000]; +cout<<"Enter the direction First letter"<=0 and y>=0){ + while(y--){ + cout<<'N'; + } + while(x--){ + cout<<'E'; + } +} +if(x<=0 and y>=0){ + while(y--){ + cout<<'N'; + } + while(x++){ + cout<<'W'; + } +} +if(x<=0 and y<=0){ + while(y++){ + cout<<'S'; + } + while(x++){ + cout<<'W'; + } +} +if(x>=0 and y<=0){ + while(y++){ + cout<<'S'; + } + while(x--){ + cout<<'E'; + } +} +return 0; +} \ No newline at end of file