Contest Experiences: Codeforces Round #888 (Div. 3)
Last Updated :
14 Sep, 2023
About Contest:
- The contest was conducted by code forces rated for Div 3 Participants.
- In the contest, there are 7 problems and 2 hours and 15 minutes to solve them.
- The penalty for the wrong submission in this round is 10 minutes.
My contest experiences:
Easy
|
Implementation, Hashing
|
10 – 15 minutes
|
1
|
Easy
|
Sorting, Two Pointer
|
8 – 10 minutes
|
1
|
Medium
|
Greedy
|
20-22 minutes
|
1
|
Medium
|
Math, Implementation
|
30 – 35 minutes
|
1
|
Link of the Contest: Codeforces Round #888 (Div. 3)
Question 1: Escalator Conversations:
- This is an easy question based on implementation and Hashing.
- I thought the only condition to make conversation with a person is the difference between Vlad’s height and the person’s height should be equal to the difference between escalators’ steps’ height.
- So I stored all the differences of steps in a map and then just searched the height difference between Vlad and people if this difference is found then we increment the count.
Question 2: Parity Sort:
- This is an Easy question based on sorting and implementation.
- I made a copy of the original array and then sort the array in non-decreasing order.
- After sorting I checked for the parity of the ith index of both the original and sorted one if the parity is different then I can not apply the operation so the answer is NO.
Question 3: Tiles Comeback:
- This is a medium-level question based on Greedy.
- What comes to my mind after reading the question is I can select any length which should be divisible by K. I tried to take only the minimum possible path length.
- If the first and last characters are the same then I only need K elements of the same color as the first element.
- Else, I need a minimum of K elements of the color type of the first element and then after this point, I need a minimum of K elements of the color type of the last element.
Question 4: Prefix Permutation Sums:
- This is a good medium-level question based on the understanding of math and implementation and observation.
- My observation here was that we get array elements by subtracting adjacent elements of its prefix sum array but it is also possible that I can get a difference greater than N which is not the array element this is due to a missing element from the prefix sum array.
- As only one number is missing then we can have only one difference that is greater than N if there is more than one then the answer is NO.
- Initially, I took a set in which 1 to N elements are inserted so as soon as I get the difference in the set then erase the element.
- Finally, take the sum of the remaining elements of the set and check it is equal to the one difference which is greater than N if it is equal then the Answer is Yes else NO.
Share your thoughts in the comments
Please Login to comment...