五月天青色头像情侣网名,国产亚洲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的評論 (共 條)

分享到微博請遵守國家法律
新巴尔虎右旗| 云龙县| 麻城市| 库车县| 宁南县| 宜黄县| 内江市| 新蔡县| 泰宁县| 夏邑县| 石嘴山市| 呼伦贝尔市| 平湖市| 北宁市| 武冈市| 福安市| 安新县| 武定县| 揭东县| 长岭县| 香港| 巴马| 抚远县| 葵青区| 双桥区| 玉山县| 时尚| 石棉县| 绍兴市| 商洛市| 潢川县| 忻城县| 开鲁县| 藁城市| 永吉县| 苍梧县| 大埔区| 涟源市| 莒南县| 盘锦市| 呼和浩特市|