find the sum of prime numbers in an array
Answers
Answered by
1
Answer:
Efficient Approach: Generate all primes up to the maximum element of the array using the sieve of Eratosthenes and store them in a hash. Now traverse the array and find the sum of those elements which are prime using the sieve. Below is the implementation of the efficient approach: C++
Explanation:
hiii
Similar questions
Environmental Sciences,
8 days ago
CBSE BOARD X,
8 days ago
Hindi,
17 days ago
History,
17 days ago
Physics,
8 months ago
English,
8 months ago