1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/生成每种字符都是奇数个的字符串 [generate-a-string-with-characters-that-have-odd-counts].html
2022-03-29 12:43:11 +08:00

34 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数 <code>n</code>,请你返回一个含<em> <code>n</code> </em>个字符的字符串,其中每种字符在该字符串中都恰好出现 <strong>奇数次</strong> <em><strong></strong></em></p>
<p>返回的字符串必须只含小写英文字母。如果存在多个满足题目要求的字符串,则返回其中任意一个即可。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>n = 4
<strong>输出:</strong>&quot;pppz&quot;
<strong>解释:</strong>&quot;pppz&quot; 是一个满足题目要求的字符串,因为 &#39;p&#39; 出现 3 次,且 &#39;z&#39; 出现 1 次。当然,还有很多其他字符串也满足题目要求,比如:&quot;ohhh&quot;&quot;love&quot;
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>n = 2
<strong>输出:</strong>&quot;xy&quot;
<strong>解释:</strong>&quot;xy&quot; 是一个满足题目要求的字符串,因为 &#39;x&#39;&#39;y&#39; 各出现 1 次。当然,还有很多其他字符串也满足题目要求,比如:&quot;ag&quot;&quot;ur&quot;
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>n = 7
<strong>输出:</strong>&quot;holasss&quot;
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 500</code></li>
</ul>