PROBLEM LINK:
Author: Harshit Pandey
Tester: Vivek Kumar Mishra
Editorialist: Vivek Kumar Mishra
DIFFICULTY:
CAKEWALK
PREREQUISITES:
PROBLEM:
Find Roll No. in the given Set.
QUICK EXPLANATION:
Use Linear Search
EXPLANATION:
Use a basic loop to go through all the Given Elements, check if any of them is 7
SOLUTIONS:
Setter's Solution
#include
using namespace std;
int main() {
int t;
cin >> t;
while(t–)
{
int n;
cin >> n;
int arr[n];
bool flag=false;
for(int i=0; i<n; ++i) cin >> arr[i];
for(int x: arr)
{
if(x==7)
{
cout << “PRESENT” << ‘\n’;
flag=true;
}
}
if(!flag) cout << “Absent” << ‘\n’;
}
return 0;
}