GCD and LCM

Write code · Medium · §2.2 Divisors and multiples

You are given two positive integers a and b. Complete the function solution, which returns a list of their greatest common divisor (GCD) and least common multiple (LCM), in that order: [GCD, LCM].

Function

solution(a, b)

Constraints

Examples

abresult
1218[6, 36]
46[2, 12]

Starter code

def solution(a, b):
    answer = [0, 0]
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.