1374. Generate a String With Characters That Have Odd Counts Easy

@problem@discussion
#String



1/**
2 * [1374] Generate a String With Characters That Have Odd Counts
3 *
4 * Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times.
5 * The returned string must contain only lowercase English letters. If there are multiples valid strings, return any of them.  
6 *  
7 * Example 1:
8 * 
9 * Input: n = 4
10 * Output: "pppz"
11 * Explanation: "pppz" is a valid string since the character 'p' occurs three times and the character 'z' occurs once. Note that there are many other valid strings such as "ohhh" and "love".
12 * 
13 * Example 2:
14 * 
15 * Input: n = 2
16 * Output: "xy"
17 * Explanation: "xy" is a valid string since the characters 'x' and 'y' occur once. Note that there are many other valid strings such as "ag" and "ur".
18 * 
19 * Example 3:
20 * 
21 * Input: n = 7
22 * Output: "holasss"
23 * 
24 *  
25 * Constraints:
26 * 
27 * 	1 <= n <= 500
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts/
33// discuss: https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn generate_the_string(n: i32) -> String {
39        String::new()
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_1374() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.