无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

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

LeetCode 2729. Check if The Number is Fascinating

2023-06-11 09:31 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an integer?n?that consists of exactly?3?digits.

We call the number?n?fascinating?if, after the following modification, the resulting number contains all the digits from?1?to?9?exactly?once and does not contain any?0's:

  • Concatenate?n?with the numbers?2 * n?and?3 * n.

Return?true?if?n?is fascinating, or?false?otherwise.

Concatenating?two numbers means joining them together. For example, the concatenation of?121?and?371?is?121371.

?

Example 1:

Input: n = 192

Output: true

Explanation: We concatenate the numbers n = 192 and 2 * n = 384 and 3 * n = 576. The resulting number is 192384576. This number contains all the digits from 1 to 9 exactly once.

Example 2:

Input: n = 100

Output: false

Explanation: We concatenate the numbers n = 100 and 2 * n = 200 and 3 * n = 300. The resulting number is 100200300. This number does not satisfy any of the conditions.

?

Constraints:

  • 100 <= n <= 999

模擬遍歷即可,只是注意下false的情形即可;

下面是代碼:

Runtime:?4 ms, faster than?28.57%?of?Java?online submissions for?Check if The Number is Fascinating.

Memory Usage:?40.2 MB, less than?28.57%?of?Java?online submissions for?Check if The Number is Fascinating.


LeetCode 2729. Check if The Number is Fascinating的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
正定县| 大冶市| 六安市| 铅山县| 辛集市| 阿克苏市| 青阳县| 高青县| 洮南市| 淳安县| 赣榆县| 讷河市| 任丘市| 湾仔区| 曲松县| 双鸭山市| 阳原县| 大丰市| 财经| 丹棱县| 古蔺县| 赤壁市| 仙游县| 车致| 米易县| 砀山县| 资阳市| 邹城市| 广灵县| 金塔县| 平阴县| 贵港市| 建昌县| 盐源县| 枝江市| 沧源| 兴山县| 平果县| 竹北市| 上饶县| 麻江县|