Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Mahmoud and Ehab and another array construction task

Правка en1, от Bibhu_295, 2018-04-07 07:38:24

Mahmoud and Ehab and another array construction task We have to make an array b such that all elements in will be coprime.

What we need to consider: First, think of how can you find the prime factors of all number present in the array in an efficient way. Prime Factorization in log(n)

Then we keep making all the prime factors of the array of as visited and if a prime factor repeats we stop and choose an element greedily and then from next place we keep feeling starting from the minimum number whose all factors are not at all visited. Source Code

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Bibhu_295 2018-04-07 07:39:04 3 Tiny change: 'ements in will be c' -> 'ements in it will be c'
en1 Английский Bibhu_295 2018-04-07 07:38:24 809 Initial revision (published)