GEHA1807 - Editorial

PROBLEM LINKS:

Practice

Contest

DIFFICULTY:

Very Easy

PROBLEM:

Given N equations we have to find the number of invalid equations if a certain lower case alphabet is not available for use after Xth equation.

EXPLANATION

The solution to the question is very simple. The invalid equations will be those which will have the given letter in their RHS. So For every equation after Xth equation we need to check if it has the given letter in its RHS(Right hand side). If it has that letter we will increase the count by 1. In the end we need to print the count.

Time Complexity

Time complexity of the above solution is O(N)

AUTHOR’S AND TESTER’S SOLUTIONS:

Setter’s solution

Tester’s solution

Feel free to comment if you have any doubt .