← ALL NOTES
Array

2197. Replace Non-Coprime Numbers in Array

Given nums: while there exist two adjacent non-coprime numbers (gcd > 1), replace them with their LCM. Repeat until impossible. Return the final array (unique regardless of order). Collapsing…

Loading…