Class Solution
java.lang.Object
g1301_1400.s1374_generate_a_string_with_characters_that_have_odd_counts.Solution
1374 - Generate a String With Characters That Have Odd Counts.<p>Easy</p>
<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><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 4</p>
<p><strong>Output:</strong> “pppz”</p>
<p><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”.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 2</p>
<p><strong>Output:</strong> “xy”</p>
<p><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”.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> n = 7</p>
<p><strong>Output:</strong> “holasss”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 500</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
generateTheString
-