[문제] Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#) (use Either String a in Haskell and Result<Vec<u32>, String> in Rust).
Example:
divisors(12); // should return [2,3,4,6]
divisors(25); // should return [5]
divisors(13); // should return "13 is prime"
'알고리즘' 카테고리의 다른 글
JS 특정 문자를 공백으로 치환 (0) | 2020.08.26 |
---|---|
JS 입력받은 단어중 가장 짧은 단어의 길이값 구하기 (0) | 2020.08.26 |
코드업 1025 자바 (0) | 2020.08.25 |
JS 퀵정렬 (0) | 2020.06.11 |
JS 병합 정렬(Merge Sort), 분할 정복 전략(Divide and Conquer) (0) | 2020.06.11 |