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

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

Leetcode 2549. Count Distinct Numbers on Board

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

You are given a positive integer?n, that is initially placed on a board. Every day, for?109?days, you perform the following procedure:

  • For each number?x?present on the board, find all numbers?1 <= i <= n?such that?x % i == 1.

  • Then, place those numbers on the board.

Return?the number of?distinct?integers present on the board after?109?days have elapsed.

Note:

  • Once a number is placed on the board, it will remain on it until the end.

  • %?stands?for the modulo operation. For example,?14 % 3?is?2.

?

Example 1:

Input: n = 5Output: 4Explanation: Initially, 5 is present on the board. The next day, 2 and 4 will be added since 5 % 2 == 1 and 5 % 4 == 1. After that day, 3 will be added to the board because 4 % 3 == 1. At the end of a billion days, the distinct numbers on the board will be 2, 3, 4, and 5.

Example 2:

Input: n = 3Output: 2Explanation: Since 3 % 2 == 1, 2 will be added to the board. After a billion days, the only two distinct numbers on the board are 2 and 3.



Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Count Distinct Numbers on Board.

Memory Usage:?38.9 MB, less than?85.71%?of?Java?online submissions for?Count Distinct Numbers on Board.


Leetcode 2549. Count Distinct Numbers on Board的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
淮滨县| 武隆县| 延长县| 义乌市| 田林县| 平武县| 彩票| 莆田市| 桃源县| 长沙市| 汨罗市| 东安县| 永春县| 牙克石市| 宝坻区| 佛坪县| 天等县| 霍山县| 兴城市| 隆德县| 通江县| 高要市| 伊金霍洛旗| 桦川县| 商洛市| 罗田县| 涿州市| 电白县| 那曲县| 长汀县| 衡南县| 长宁县| 通辽市| 陆河县| 凉山| 鄱阳县| 大荔县| 大洼县| 双桥区| 连山| 兖州市|