Sliding Window
永远的EMT
每天时刻保持超越自我的意识
展开
-
【LeetCode】713. Subarray Product Less Than K
Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than k. Example 1: Input: nums ...原创 2019-07-01 00:17:05 · 145 阅读 · 0 评论 -
【LeetCode】Minimum Window Substring
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC" Note: I...原创 2019-07-01 00:26:19 · 128 阅读 · 0 评论 -
【LeetCode】Longest Substring with At Most Two Distinct Characters
给定一个字符串 s ,找出至多包含两个不同字符的最长子串 t 。 示例 1: 输入: "eceba" 输出: 3 解释: t 是 "ece",长度为3。 示例 2: 输入: "ccaabbb" 输出: 5 解释: t 是 "aabbb",长度为5。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/longest-substrin...原创 2019-07-01 00:47:50 · 203 阅读 · 0 评论 -
【LeetCode】904. Fruit Into Baskets
In a row of trees, the i-th tree produces fruit with type tree[i]. You start at any tree of your choice, then repeatedly perform the following steps: Add one piece of fruit from this tree to your b...原创 2019-07-01 00:53:42 · 173 阅读 · 0 评论 -
【LeetCode】239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window ...原创 2019-07-01 01:00:58 · 103 阅读 · 0 评论