国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

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

LeetCode 1016. Binary String With Substrings Representing 1 To N

2023-05-11 07:53 作者:您是打尖兒還是住店呢  | 我要投稿

Given a binary string?s?and a positive integer?n, return?true?if the binary representation of all the integers in the range?[1, n]?are?substrings?of?s, or?false?otherwise.

A?substring?is a contiguous sequence of characters within a string.

?

Example 1:

Input: s = "0110", n = 3

Output: true

Example 2:

Input: s = "0110", n = 4

Output: false

?

Constraints:

  • 1 <= s.length <= 1000

  • s[i]?is either?'0'?or?'1'.

  • 1 <= n <= 109

使用自帶函數(shù)Integer.toBinaryString()就可以的,遍歷確認(rèn)接,下面是代碼:

Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Binary String With Substrings Representing 1 To N.

Memory Usage:?40.4 MB, less than?72.27%?of?Java?online submissions for?Binary String With Substrings Representing 1 To N.


LeetCode 1016. Binary String With Substrings Representing 1 To N的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
平武县| 栖霞市| 白水县| 滕州市| 长乐市| 紫金县| 巴里| 贵州省| 平利县| 鄢陵县| 泽州县| 南投市| 桂平市| 南昌市| 南江县| 通辽市| 梧州市| 汝州市| 姚安县| 息烽县| 轮台县| 永吉县| 庆阳市| 和龙市| 商洛市| 桐城市| 宣化县| 天柱县| 洪泽县| 沂水县| 永善县| 育儿| 营山县| 恩施市| 青田县| 昭通市| 锡林郭勒盟| 无棣县| 称多县| 金华市| 台安县|