5

PROBLEM OF THE DAY : 08/12/2023 | Transform to prime

 9 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-08122023-transform-to-prime/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

PROBLEM OF THE DAY : 08/12/2023

December 09, 2023 |1.0K Views
PROBLEM OF THE DAY : 08/12/2023 | Transform to prime
Problem of the Day, prime numbers, Data Structure and Algorithm
 Save  Share  1 Like
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. 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, an array of n integers. Find the minimum positive number to be inserted in the array, so that the sum of all elements of the array becomes prime.

Example :

Input:
N=5
arr = {2, 4, 6, 8, 12}
Output:  
5

Explanation: 
The sum of the array is 32, we can add 5 to this to make it 37 which is a prime number

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/transform-to-prime4635/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/26320440-e4b9-4660-9a87-cf11826e35de

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK