less than 1 minute read

You can write out a number as a product of prime numbers, which are its prime factors. The same prime factor may occur more than once.

Given an integer n greater than 1, find all of its prime factors and return them in sorted order.

https://binarysearch.com/problems/Prime-Factorization

Examples

Example 1

Input

  • n = 12

Output

  • answer = [2, 2, 3]

Explanation

2 _ 2 _ 3 = 12

Solution

Leave a comment