最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode 1374. Generate a String With Characters That Have Odd C

2023-03-22 15:06 作者:您是打尖兒還是住店呢  | 我要投稿

Given an?integer?n,?return a string with?n?characters such that each character in such string occurs?an odd number of times.

The returned string must contain only lowercase English letters. If there are multiples valid strings, return?any?of them. ?

?

Example 1:

Input: n = 4

Output: "pppz"

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".

Example 2:

Input: n = 2

Output: "xy"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".

Example 3:

Input: n = 7

Output: "holasss"

easy 題目,不贅述,就是當(dāng)n為偶數(shù),返回N-1個a加1個b,如果n為奇數(shù),就返回N個a

Runtime:?1 ms, faster than?80.59%?of?Java?online submissions for?Generate a String With Characters That Have Odd Counts.

Memory Usage:?40.2 MB, less than?58.23%?of?Java?online submissions for?Generate a String With Characters That Have Odd Counts.


Leetcode 1374. Generate a String With Characters That Have Odd C的評論 (共 條)

分享到微博請遵守國家法律
共和县| 观塘区| 通榆县| 竹山县| 巴彦淖尔市| 新巴尔虎左旗| 萨嘎县| 衡水市| 梁平县| 桂东县| 松潘县| 涞源县| 容城县| 石城县| 云和县| 丰都县| 黑龙江省| 论坛| 荔浦县| 苗栗市| 常德市| 南充市| 苍梧县| 泾源县| 文安县| 北宁市| 九寨沟县| 泸溪县| 贞丰县| 色达县| 元阳县| 马公市| 祥云县| 嘉峪关市| 那曲县| 万宁市| 东宁县| 盐源县| 霍州市| 丹凤县| 威信县|