Java: Shift characters and compare
Given two strings A and B, return
whether or not A can be shifted some number of times to get B.
For example,
if
A is abcde and B is cdeab, return true.
If
A is abc and B is acb, return false.
The Problem is much similar to :Using String inbuilt methods
Hope you can trace and understand easily 😊
Note:
·
The above
solution is not the ultimate or the only way to approach the problem.
·
Attaching
screenshot because you need to practice than copying code and executing in IDE.
·
As I said
there are ‘N’ number of ways to solve the issue, here I tried using inbuilt
methods from String class and get the solution.
·
Comments and
suggestions are always welcome.
Comments
Post a Comment