Find All Divisors
Divisors show which numbers can divide n without a remainder. The function divisors receives an integer n and returns a list of all its positive divisors. The result should be sorted in ascending order.
Примеры
Ввод
6Вывод
[1, 2, 3, 6]Ввод
1Вывод
[1]Ввод
12Вывод
[1, 2, 3, 4, 6, 12]Нужно реализовать
def divisors(n: int) -> list[int]:
Теги
mathlists
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
6Expected
[1,2,3,6]2
Input
1Expected
[1]3
Input
12Expected
[1,2,3,4,6,12]4
Input
7Expected
[1,7]5
Input
9Expected
[1,3,9]6
Input
10Expected
[1,2,5,10]Focus radio
Paused · SomaFM · Fluid