Skip to content

CGreenP/NPTEL-Introduction-to-Programming-in-C-Assignment-4-Question-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

NPTEL-Introduction-to-Programming-in-C-Assignment-4-Question-1

NPTEL Introduction to Programming in C Assignment 4 Question 1

Question 1

Given two arrays of integers output the smallest number in the first array not present in the second one.

Input Specification:

The first line contains the size N1 of the first array.

Next line give the contents of the first array.

Next line contains the size N2 of the second array.

Next line give the contents of the second array.

Output Format:

Output must be a single number which is the smallest number occurring in the first array that does not occur in the second. In case there is no such number, output NO.

Variable Constraints:

The sizes of the arrays are smaller than 20.

Each array entry is an integer which fits an int data type.

Example:

Input:

3
2 3 4
4
1 3 5 7

Output:

2

Input:

1
1
2
1 2

Output:

NO

Sample Input 1

5
1 2 3 4 5
3
2 7 9

Sample Output 1

1

Sample Input 2

4
3 5 7 9
4
7 9 10 55

Sample Output 2

3

Sample Input 3

2
4 6
2
4 7

Sample Output 3

6

Sample Input 4

3
2 7 1
3
1 7 2

Sample Output 4

NO

Releases

No releases published

Packages

No packages published

Languages