GSRM01B - Editorial

PROBLEM LINK:

Author: Omkar Prabhu

Tester: Omkar Prabhu

Editorialist: Omkar Prabhu

DIFFICULTY:

EASY

PROBLEM:

You have to find the number of common occurrences of time.

EXPLANATION:

Given two arrays A[] and B[].

For every A[i] from 1 to N, check if there is B[i].

Increment your counter, every time, you find a match.

Print your counter value.

AUTHOR’S AND TESTER’S SOLUTIONS:

Solution: http://ideone.com/WPrczf

#include<stdio.h>
#include<conio.h>
void main()
{
int a[],b[],i,ctr=0;
printf(“enter elements in 1 array”);
scanf("%d",&a[i]);
printf(“enter elements in 2 array”);
scanf("%d",&b[i]);
for(i=0;i<=n;i++)
{
if(a[i]==b[i])
{ctr++;
}
}
printf("%d",ctr);
getch();
}