3210. Find the Encrypted String Easy

@problem@discussion
#String



1/**
2 * [3210] Find the Encrypted String
3 *
4 * You are given a string s and an integer k. Encrypt the string using the following algorithm:
5 * 
6 * 	For each character c in s, replace c with the k^th character after c in the string (in a cyclic manner).
7 * 
8 * Return the encrypted string.
9 *  
10 * <strong class="example">Example 1:
11 * <div class="example-block">
12 * Input: <span class="example-io">s = "dart", k = 3</span>
13 * Output: <span class="example-io">"tdar"</span>
14 * Explanation:
15 * 
16 * 	For i = 0, the 3^rd character after 'd' is 't'.
17 * 	For i = 1, the 3^rd character after 'a' is 'd'.
18 * 	For i = 2, the 3^rd character after 'r' is 'a'.
19 * 	For i = 3, the 3^rd character after 't' is 'r'.
20 * </div>
21 * <strong class="example">Example 2:
22 * <div class="example-block">
23 * Input: <span class="example-io">s = "aaa", k = 1</span>
24 * Output: <span class="example-io">"aaa"</span>
25 * Explanation:
26 * As all the characters are the same, the encrypted string will also be the same.
27 * </div>
28 *  
29 * Constraints:
30 * 
31 * 	1 <= s.length <= 100
32 * 	1 <= k <= 10^4
33 * 	s consists only of lowercase English letters.
34 * 
35 */
36pub struct Solution {}
37
38// problem: https://leetcode.com/problems/find-the-encrypted-string/
39// discuss: https://leetcode.com/problems/find-the-encrypted-string/discuss/?currentPage=1&orderBy=most_votes&query=
40
41// submission codes start here
42
43impl Solution {
44    pub fn get_encrypted_string(s: String, k: i32) -> String {
45        String::new()
46    }
47}
48
49// submission codes end
50
51#[cfg(test)]
52mod tests {
53    use super::*;
54
55    #[test]
56    fn test_3210() {
57    }
58}
59


Back
© 2025 bowen.ge All Rights Reserved.