RECENTCONT Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Hrishikesh
Tester: Abhinav Sharma, Utkarsh Gupta
Editorialist: Pratiyush Mishra

DIFFICULTY:

793

PREREQUISITES:

None

PROBLEM:

CodeChef recently revamped its practice page to make it easier for users to identify the next problems they should solve by introducing some new features:

  • Recent Contest Problems - Contains only problems from the last 2 contests
  • Separate Un-Attempted, Attempted, and All tabs
  • Problem Difficulty Rating - The Recommended dropdown menu has various difficulty ranges so that you can attempt the problems most suited to your experience
  • Popular Topics and Tags

Chef has been participating regularly in rated contests but missed the last two contests due to his college exams. He now wants to solve them and so he visits the practice page to view these problems.

Given a list of N problem codes, where each problem code is either START38 or LTIME108, help Chef count how many problems were featured in each of the contests.

EXPLANATION:

This is a simple array traversal problem. Just keep two counts, start and ltime to keep the count of problems having problem code as START38 and LTIME108 respectively.
Traverse through the array of strings and if current word is START38, then increment start by 1 else increment ltime by 1.

TIME COMPLEXITY:

O(N), for each test case.

SOLUTION:

Editorialist’s Solution
Tester1’s Solution
Tester2’s Solution