Rearranging digits to get a multiple of 5 || April Cook-Off 2022 Editorial

Here Below I written my Solution of Important Pages on CodeChef in Two different Languages C++ and Python.

Solution in C++ :

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int t = 1;
	cin >> t;
	while (t--)
	{
		int n;
		string s;
		cin >> n >> s;
		for (int i = 0; i < n; i++)
		{
			if (s[i] == '5' || s[i] == '0')
			{
				cout << "Yes\n";
				return;
			}
		}
		cout << "No\n";
	}
}

Solution in Python3 :

tc = int(input())

for _ in range(0,tc):
    n = int(input())
    num = str(input())

    CountZero = 0
    CountFive = 0
    
    for ch in num:
        if(ch == '0'):
            CountZero += 1 
        elif(ch == '5'):
            CountFive += 1 
    
    if(CountFive > 0 or CountZero > 0):
        print("Yes")
    else:
        print("No")