PROBLEM LINK:
CDVB2022/CHEFRACE
CDVE2022/CHEFRACE
Author: aaryan_musk
DIFFICULTY
Easy-Medium
PREREQUISITES
Searching and Sorting
EXPLANATION
Some Observation:
- We are given the timings in unsorted order.
- We need to find the smallest 3 distinct timings.
Approach:
-
We need to sort the array to find the smallest timings.
-
If the the timing we printed and the next timing in the sorted array is the same we will print that timing together.
-
We will keep track of the number of positions we have printed when that becomes equal to 3 we will have our answer.
SOLUTIONS
C++ Solution: CHEFRACE C++ Solution
Python Solution: CHEFRACE Python Solution