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

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

LeetCode 2810. Faulty Keyboard

2023-08-10 11:03 作者:您是打尖兒還是住店呢  | 我要投稿

Your laptop keyboard is faulty, and whenever you type a character?'i'?on it, it reverses the string that you have written. Typing other characters works as expected.

You are given a?0-indexed?string?s, and you type each character of?s?using your faulty keyboard.

Return?the final string that will be present on your laptop screen.

?

Example 1:

Input: s = "string"Output: "rtsng"Explanation: After typing first character, the text on the screen is "s". After the second character, the text is "st". After the third character, the text is "str". Since the fourth character is an 'i', the text gets reversed and becomes "rts". After the fifth character, the text is "rtsn". After the sixth character, the text is "rtsng". Therefore, we return "rtsng".

Example 2:

Input: s = "poiinter"Output: "ponter"Explanation: After the first character, the text on the screen is "p". After the second character, the text is "po". Since the third character you type is an 'i', the text gets reversed and becomes "op". Since the fourth character you type is an 'i', the text gets reversed and becomes "po". After the fifth character, the text is "pon". After the sixth character, the text is "pont". After the seventh character, the text is "ponte". After the eighth character, the text is "ponter". Therefore, we return "ponter".

?

Constraints:

  • 1 <= s.length <= 100

  • s?consists of lowercase English letters.

  • s[0] != 'i'

----------------------------------------------------


Runtime:?3 ms, faster than?98.76%?of?Java?online submissions for?Faulty Keyboard.

Memory Usage:?43.6 MB, less than?83.32%?of?Java?online submissions for?Faulty Keyboard.



LeetCode 2810. Faulty Keyboard的評論 (共 條)

分享到微博請遵守國家法律
岳西县| 岫岩| 宿迁市| 张家川| 南城县| 本溪市| 英吉沙县| 历史| 铁力市| 富平县| 内江市| 泊头市| 来安县| 昔阳县| 丰镇市| 铁力市| 柘城县| 马关县| 迁安市| 万州区| 吴桥县| 冀州市| 孟村| 陇南市| 商水县| 涟水县| 定西市| 兰溪市| 永济市| 江安县| 孟州市| 济阳县| 罗定市| 柳州市| 色达县| 诸暨市| 长汀县| 陆川县| 晋宁县| 凤山县| 宜都市|