Company: IBM SDE off-campus_19april
Difficulty: medium
You are given a sorted array points[] representing the point values of math problems a student must solve in order. The student must follow these rules: They must solve the first problem (index 0). After solving a problem at index i , they may solve either: the next problem (index i + 1) the one after th at (i + 2) They continue solving problems until: the difference between the maximum and minimum solved point values is ≥ threshold If this threshold can never be met, the student must solve all problems. Your task is to determine the minimum n umber of problems the student needs to solve. Example 1 Input: threshold = 4, n = 5 elements, points = [1, 2, 3, 5, 8]\nOutput: 3\nExplanation: Solve questions with point values 1, 3, and 5: 5 - 1 ≥ 4 Example 2 Input: threshold = 4, n = 5 elements, points = [1, 2, 3, 4, 5]\nOutput: 3\nExplanation: Solve questio ns with point values 1, 3, and 5: 5 - 1 ≥ 4 Constraints 1 ≤ n ≤ 10 5 1 ≤ points[i] ≤ 1000 1 ≤ threshold ≤ 1000 Test Case Input Format The