Find the Encrypted 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.
You are given a string s and an integer k. Encrypt the string using the following algorithm:
- For each character
cins, replacecwith thek<sup>th</sup>character aftercin the string (in a cyclic manner).
Return the encrypted string.
LeetCode Problem - 3210
class Solution {
public String getEncryptedString(String s, int k) {
// Initialize a StringBuilder to build the encrypted string
StringBuilder sb = new StringBuilder();
// Get the length of the input string
int n = s.length();
// Iterate through each character of the input string
for (int i = 0; i < n; i++) {
// Append the character at the new position (i + k) % n to the StringBuilder
sb.append(s.charAt((i + k) % n));
}
// Convert the StringBuilder to a string and return it
return sb.toString();
}
}




