Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Deque RotateString
//g++ 7.4.0 //deque rotate string //original credit geeks for geeks #include <iostream> #include <deque> using namespace std; void rotate (deque<string > a, int d,int n) { for(int i=0; i<d; i++){ string val = a.back(); a.pop_back(); a.push_front(val); } for(int i=0; i<n; ++i) { cout<<a[i]<<" "; } cout<<endl; } int main () { deque<string> s={"Hi","There","How","Are","You","?"}; int n = s.size(); int d=2; rotate (s,d%n,n); return 0; }
run
|
edit
|
history
|
help
0
hey
w1
queue
Test 13(2020)
use of assert to check a particular situation! (throws error)
Dar
OOP
kroliki
133
ONP