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

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

LeetCode 930. Binary Subarrays With Sum

2023-04-14 14:14 作者:您是打尖兒還是住店呢  | 我要投稿

Given a binary array?nums?and an integer?goal, return?the number of non-empty?subarrays?with a sum?goal.

A?subarray?is a contiguous part of the array.

?

Example 1:

Input: nums = [1,0,1,0,1], goal = 2

Output: 4

Explanation:?

The 4 subarrays are bolded and underlined below:?

[1,0,1,0,1]

[1,0,1,0,1]?

[1,0,1,0,1]?

[1,0,1,0,1]

Example 2:

Input: nums = [0,0,0,0,0], goal = 0

Output: 15

?pre_sum題型,會了1道,其他的基本都會了。

Constraints:

  • 1 <= nums.length <= 3 * 104

  • nums[i]?is either?0?or?1.

  • 0 <= goal <= nums.length


Runtime:?2241 ms, faster than?5.07%?of?Java?online submissions for?Binary Subarrays With Sum.

Memory Usage:?47 MB, less than?41.47%?of?Java?online submissions for?Binary Subarrays With Sum.


LeetCode 930. Binary Subarrays With Sum的評論 (共 條)

分享到微博請遵守國家法律
乐至县| 修水县| 肥城市| 中西区| 建宁县| 大悟县| 兴宁市| 九龙城区| 综艺| 塔河县| 滨州市| 大渡口区| 西宁市| 晋中市| 镇江市| 南漳县| 南华县| 和静县| 黔南| 密云县| 常州市| 来凤县| 邵阳市| 安仁县| 冷水江市| 电白县| 郧西县| 虞城县| 湖南省| 曲松县| 息烽县| 三亚市| 兰西县| 望都县| 石林| 简阳市| 双柏县| 洛隆县| 荣成市| 故城县| 琼中|