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

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

Leetcode386. Lexicographical Numbers

2023-01-19 12:53 作者:您是打尖兒還是住店呢  | 我要投稿

Given an integer?n, return all the numbers in the range?[1, n]?sorted in lexicographical order.

You must write an algorithm that runs in?O(n)?time and uses?O(1)?extra space.?

?

Example 1:

Input: n = 13Output: [1,10,11,12,13,2,3,4,5,6,7,8,9]

Example 2:

Input: n = 2Output: [1,2]

?

Constraints:

  • 1 <= n <= 5 * 104

沒想到能過,以為會(huì)超時(shí)的;空間反正是超了的;

Runtime18 ms

Beats

25.95%

Memory48.6 MB

Beats

54.73%

Click to check the distribution chart


Leetcode386. Lexicographical Numbers的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
富蕴县| 舟山市| 隆化县| 文安县| 盐边县| 昆山市| 阜新市| 万宁市| 青神县| 秭归县| 托克逊县| 湘乡市| 罗田县| 长沙县| 汉川市| 莱芜市| 肇州县| 宣武区| 边坝县| 来凤县| 晋江市| 镇原县| 张家界市| 灌南县| 孝义市| 吐鲁番市| 依安县| 墨江| 山阳县| 蕲春县| 资阳市| 翁牛特旗| 凤翔县| 霍山县| 金昌市| 常山县| 广饶县| 鹤庆县| 乌拉特前旗| 龙陵县| 稷山县|