Return two prime numbers gfg problem of the day | 2 prime numbers whose sum equals given number
Автор: Code with Alisha
Загружено: 2022-02-23
Просмотров: 3844
Описание:
Given an even number N (greater than 2), return two prime numbers whose sum will be equal to given number. There are several combinations possible. Print only the pair whose minimum value is the smallest among all the minimum values of pairs and print the minimum element first.
NOTE: A solution will always exist, read Goldbachs conjecture.
Example 1:
Input: N = 74
Output: 3 71
Explaination: There are several possibilities
like 37 37. But the minimum value of this pair
is 3 which is smallest among all possible
minimum values of all the pairs.
Example 2:
Input: 4
Output: 2 2
Explaination: This is the only possible
prtitioning of 4.
Your Task:
You do not need to read input or print anything. Your task is to complete the function primeDivision() which takes N as input parameter and returns the partition satisfying the condition.
Expected Time Complexity: O(N*log(logN))
Expected Auxiliary Space: O(N)
Connect with me on LinkedIn : / alisha-parveen-80579850
Check out our other playlists:
Dynamic Programming:
• Dynamic Programming
Trees:
• Trees
Heaps and Maps:
• Heaps and Maps
Arrays and Maths:
• Arrays and Maths
Bit Manipulation:
• Bit Manipulation
Greedy Algorithms:
• Greedy Algorithms
Sorting and Searching:
• Sorting and Searching
Strings:
• Strings
Linked Lists:
• Linked Lists
Stack and Queues:
• Stacks and Queues
Two Pointers:
• Two pointers
Graphs, BFS, DFS:
• Graphs, DFS, BFS
Backtracking:
• Backtracking
Non- DSA playlists:
Probability:
• Probability
SQL-Basic Join functions:
• SQL - Basic JOIN Functions
SQL-Basic Aggregate functions:
• SQL-Basic Aggregate Functions
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: