Company: Springworks__
Difficulty: medium
Smart Ad Injection System Problem Description You are implementing a Smart Ad Injection system. You have a list of potential timestamps (in seconds) where an ad could be placed. However, to keep the user happy, you must ensure that any two ads shown are at least K seconds apart. Given the sorted list of potential timestamps and the minimum gap K , return the maximum number of ads you can show. Note: You always pick the first valid timestamp to maximize the count. Examples Example 1: Input: timestamps = [10, 20, 30, 40], K = 15 Output: 2 Explanation: Show ad at 10. Next avail at 20? Gap (20-10)=10. Too small (Needs 15). Next avail at 30? Gap (30-10)=20. OK! Show ad at 30. Next avail at 40? Gap (40-30)=10. Too small. Total shown: 2 (at 10 and 30). Example 2: Input: timestamps = [1, 2, 3, 10], K = 5 Output: 2 Explanation: Ad at 1. Next valid is 10 (diff 9). Total 2.