⌘K
Flycodx

Gold Purity Batch Range Filter

Gold Purity Batch Range Filter

MediumArrays0% accepted

Arjun operates a gold loan shop in Mumbai. He tracks purity scores of gold items and needs to find the longest sequence of consecutive items falling within an acceptable purity range for bulk processing.

Approach

Given an array of gold purity scores and a purity range [min, max], find the length of the longest consecutive subarray where all elements fall within the range.

Input

purities=[22,24,22,20,18,22,24], min=20, max=24

Output

4
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3