LeetCode solutions

3468. Find the Encrypted String

My accepted C++ solution to LeetCode problem 3468, Find the Encrypted String, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 9.2MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 9.2MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    string getEncryptedString(string s, int k) {
        int n = s.size();
        k %= n;
        return s.substr(k) + s.substr(0, k);
    }
};

Source