Rotate String

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.
A shift on s consists of moving the leftmost character of s to the rightmost position.
- For example, if
s = "abcde", then it will be"bcdea"after one shift.
LeetCode Problem - 796
class Solution {
public boolean rotateString(String s, String goal) {
// If the lengths of the two strings are different, they can't be rotations of each other
if (s.length() != goal.length()) return false;
// Concatenate string 's' with itself and check if 'goal' is a substring of the result
// If 'goal' is a rotation of 's', it will definitely appear as a substring in 's+s'
return (s + s).contains(goal);
}
}




