You are on page 1of 3

Contest Link: (Div - 4)

https://codeforces.com/contestInvitation/2c757fd2abf950ce04524f557728feb0dd455055

Editorial: A
Original Problem: https://codeforces.com/contest/855/problem/A

Basic Implementation of Sets. Insert each string in the set and check if its size changes or not.

CODE: Submission

Editorial: B
Original Problem: https://codeforces.com/contest/386/problem/A

Just find the index of the first and second maximum prices. See Submission for a better
implementation.

CODE: Submission

Editorial: C
Original Problem: https://codeforces.com/contest/1833/problem/B

Observation: If array a was sorted, then if we sorted b, it would be our answer.

This problem can be solved using greedy algorithm.


CODE: Submission

Editorial: D
Original Problem: https://codeforces.com/contest/1077/problem/B

Observation: If we have “1 0 1” in our array, then only we have to replace any of the two ones
with zero.

If we iterate over i from 2 to n-1 and whenever we encounter arr[i-1] = 1, arr[i] = 0 & arr[i+1] = 1
(i.e. “1 0 1”), we should do arr[i+1] := 0. This will give us the minimum number of steps.

If we try to set arr[i-1] = 0, then it would not result in the minimum number of steps. e.g:
"1101011” if we set arr[2] = 0 then we will also have to set arr[4] = 0 but it can be done also by
replacing arr[4] by 1 only resulting in only one step.

CODE: Submission

Editorial: E
Original Problem: https://codeforces.com/contest/1631/problem/B

Quite an interesting problem, with an insightful observation.


Observation: All elements can only be equal to last element and nothing else.

After this observation, it is very simple to make logic which would be to check from backwards
until you get any element which is not equal to A[n-1] (last element) and take k to be size from
that index till n-1 (till last element). Repeat this process from n-2k and so on until all array has
been covered.

CODE: Submission

Editorial: F (The UNSOLVED Problem)


Original Problem: https://codeforces.com/contest/1840/problem/D
CODE: Submission

You might also like