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

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
道孚县| 湘阴县| 镇江市| 厦门市| 芦山县| 雅安市| 清涧县| 灌阳县| 苗栗县| 礼泉县| 琼海市| 扶风县| 张北县| 甘谷县| 定陶县| 雷州市| 江孜县| 法库县| 南丰县| 丽水市| 淅川县| 白水县| 阿拉尔市| 银川市| 光泽县| 连城县| 广昌县| 清徐县| 大方县| 沙洋县| 开封市| 巍山| 阿勒泰市| 莆田市| 广元市| 托克逊县| 尖扎县| 栾川县| 怀宁县| 获嘉县| 桦川县|