Question d’entretien chez Stellar Science

How would you code this specific algorithm?