五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

分享到微博請遵守國家法律
六枝特区| 皋兰县| 稻城县| 资阳市| 江安县| 左贡县| 龙陵县| 大竹县| 长海县| 金门县| 梁河县| 榆林市| 鄂伦春自治旗| 罗山县| 海口市| 宾川县| 邢台市| 萨嘎县| 宁安市| 衡南县| 濮阳县| 广宗县| 西乌| 灵山县| 夏邑县| 栾城县| 垦利县| 青浦区| 陕西省| 鄱阳县| 霞浦县| 南皮县| 泸定县| 丰原市| 镇平县| 乌拉特中旗| 奉新县| 泰和县| 利津县| 文昌市| 黑水县|