All Factors

Given a number N, find all factors of N.


N = 6 
factors = {1, 2, 3, 6}

Make sure the returned array is sorted.

Problem Approach:

Complete code in the hint.

Interview Code Editor
  • Complete Solution
10345 successful submissions.
Click here to jump start your coding interview preparation