How can we shift an array circularly in optimal way?
Suppose we have an array a1,a2,.......,am,b1,b2,....,bn and we want the final array as b1,b2,.......,bn,a1,a2,....,am.
Is O(n) time and O(1) space algorithm possible??
Do 3 time reverse like:
1234567
5432176
6712345
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment