AMANLC - Editorial

PROBLEM LINK:

A Success To Date
Practice

Author: John Nixon
Tester: John Nixon
Editorialist: John Nixon

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Once upon a time in a Fairy land , there lived two lovers AMAN and LC .

Due to some circumstances LC can go on a date with AMAN only on Even Dates eg 2,30,14,...


You are given an array of distinct positive integers Dates.


Each integer in the array denoted by Dates[i]
represents a Date on which AMAN is free to take her on a date.

You being AMAN’s best friend your task is to help him to find Total number of Dates they can go.

QUICK EXPLANATION:

Loop through all the Date in the Date's array
for every Date in array check if it is a even Date if yes increment a ans variable .

EXPLANATION:

For the problem we are given a set of Date's our lover Aman is free on ,but because of LC's circumstances we Aman is restricted to go on date only on even Date's

So to help Aman we are gonna loop through all the given Date's and check if a given Date is even if yes then we are going to increment a ans variable and lastly print the maximum number of dates that Aman can go on which is stored in our ans variable.

SOLUTIONS:

Setter's Solution
for _ in range(int(input())):
    n = int(input())
    ans = 0
    Dates = list(map(int,input().split()))
    for date in Dates:
        if date%2 == 0:
            ans += 1 
    
    print(ans)

Feel free to share your approach here. Suggestions are always welcomed. :slight_smile: