You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
What if n is larger than the number of characters in the string?
This won't be the case, 1 <= n <= len(str).
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Slide the input string into two components and then combine them at the end.
1) Slice the second half of the string (the characters from n onward)
2) Slice the first half of the string (the characters up to n)
3) Return these two components added together in the order: second, first