FINLOT - Editorial

PROBLEM LINK:

Practice
Contest

Author: Ayush Nagal

DIFFICULTY:
EASY-MEDIUM.

PREREQUISITES:
Array

PROBLEM:
Given two arrays a and b, we have to find the numbers missing in the array a. A number is said to be missing if its frequency is different in both the arrays, a and b.

EXPLANATION:
The main task is to find the frequency of numbers in each array. This can be done using count array. If the frequency of a number is different, then print that number. Count array can be created in the following way:

int h[10001]={0};
for(int i=0;i<n;i++)
{
  cin>>t;
  h[t]++;
}

So like this, we can have two count arrays for each array. Then we need to run a loop for the count array. While traversing the array if frequencies mismatch, print that number.

AUTHOR’S SOLUTION:
Author’s solution can be found here.

3 Likes