Practice Find Good Days to Rob the Bank
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Return every day i with at least time preceding days and time following days, such that security is nonincreasing from i - time through i and nondecreasing from i through i + time. With time = 0, every day qualifies. Return the qualifying indices in any order.
Source: Find Good Days to Rob the Bank on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
security = [5,3,3,3,5,6,2], time = 2
Output
[2,3]
# Example 2
Input
security = [1,1,1,1,1], time = 0
Output
[0,1,2,3,4]
# Example 3
Input
security = [1,2,3,4,5,6], time = 2
Output
[]
Constraints
1 <= security.length <= 10^5
0 <= security[i], time <= 10^5
Related LeetCode Problems
Practice more problems similar to Find Good Days to Rob the Bank.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.