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

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
静宁县| 乌拉特前旗| 岳普湖县| 蒙阴县| 商丘市| 南昌县| 方城县| 池州市| 舞阳县| 扶余县| 轮台县| 惠东县| 大田县| 页游| 从化市| 武义县| 泽库县| 新安县| 西青区| 彭山县| 丽水市| 桃园县| 安义县| 灌阳县| 盘锦市| 夹江县| 克什克腾旗| 灵武市| 富裕县| 文成县| 日喀则市| 铁力市| 钟山县| 南投市| 连云港市| 绿春县| 广灵县| 海伦市| 台湾省| 衡水市| 农安县|