Sorted Range Reporter
Challenge on lesson: Checkpoint: Algorithms
CHALLENGE
Difficulty: beginner+25 XP
Implement void sort_asc(int *a, int n) (any in-place algorithm) and int in_range(const int *sorted_a, int n, int lo, int hi) counting elements of the ALREADY-SORTED array within [lo, hi] inclusive. For full credit, in_range should exploit sortedness with a scan that can stop early (or binary search twice) โ but a correct linear scan also passes.
Press Submit to check your solution.
Back to lesson: Checkpoint: Algorithms