Given an array arr and an integer d, count the number of triplets (i, j, k) such that i < j < k and the difference between the maximum and minimum element in the triplet is at most d. Return the count modulo 10^9 + 7. The optimal solution uses sorting + two pointers/sliding window + combinations to count valid triplets efficiently.
Given a runner's sex and marathon_name, use a paginated REST API to find the runner with the highest top_speed. First fetch page 1 to get total_pages, then iterate through all pages, process the data array, track the maximum top_speed, and return the corresponding runner's name. This tests API handling, pagination, JSON parsing, and iteration, not advanced DSA.