mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
35 lines
1.3 KiB
HTML
35 lines
1.3 KiB
HTML
<p>Given an integer <code>n</code>, <em>return a string with <code>n</code> characters such that each character in such string occurs <strong>an odd number of times</strong></em>.</p>
|
|
|
|
<p>The returned string must contain only lowercase English letters. If there are multiples valid strings, return <strong>any</strong> of them. </p>
|
|
|
|
<p> </p>
|
|
<p><strong>Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> n = 4
|
|
<strong>Output:</strong> "pppz"
|
|
<strong>Explanation:</strong> "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".
|
|
</pre>
|
|
|
|
<p><strong>Example 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> n = 2
|
|
<strong>Output:</strong> "xy"
|
|
<strong>Explanation:</strong> "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".
|
|
</pre>
|
|
|
|
<p><strong>Example 3:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> n = 7
|
|
<strong>Output:</strong> "holasss"
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= n <= 500</code></li>
|
|
</ul>
|