The First Meeting
Practice
0 (0 votes)
Easy
Math
Problem
93% Success 308 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array, A, of length N. Find the absolute difference between the smallest and largest prime number in array A.

Input:
First line contains an integer, N, number of points.
Second line contains N space separated integers, \(A_i\), denoting the elements of the array A.

Output:
Print the absolute difference between the smallest and largest prime number in array A, otherwise 1.

Constraints:
\(1 \le N \le 10^6\)
\(1 \le A_i \le 10^6\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
18 votes
Tags:
AlgorithmsBinary SearchMediumPrefix sumSearchingTwo pointerprefix-sum
Points:10
195 votes
Tags:
AlgorithmsEasySearching
Points:30
15 votes
Tags:
ArraysHash MapsHash TablesHiringMedium