|
1 | 1 | packagecom.fishercoder.solutions; |
2 | 2 |
|
3 | | -/** |
4 | | - * 1374. Generate a String With Characters That Have Odd Counts |
5 | | - * |
6 | | - * Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times. |
7 | | - * The returned string must contain only lowercase English letters. If there are multiples valid strings, return any of them. |
8 | | - * |
9 | | - * Example 1: |
10 | | - * Input: n = 4 |
11 | | - * Output: "pppz" |
12 | | - * 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". |
13 | | - * |
14 | | - * Example 2: |
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 | | - * Input: n = 7 |
21 | | - * Output: "holasss" |
22 | | - * |
23 | | - * Constraints: |
24 | | - * 1 <= n <= 500 |
25 | | - * */ |
26 | 3 | publicclass_1374 { |
27 | 4 | publicstaticclassSolution1 { |
28 | 5 | publicStringgenerateTheString(intn) { |
|