Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.
In this problem, we are given, two integer arrays a of size n and b of size m, the task is to find the numbers which are present in the first array a, but not present in the second array b.
Note: Numbers to be returned should in order as they appear in array a.
Example :
Input:
n = 6, m = 5
a[] = {1, 2, 3, 4, 5, 10}
b[] = {2, 3, 1, 0, 5}
Output:
4 10
Explanation:
4 and 10 are present in first array, but not in second array.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/in-first-but-second5423/1