You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
Will n always be a positive integer?
Yes.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through each number less than or equal to n, and add it to a list if it evenly divides n.
1) Create an empty list variable to store the divisors
2) Loop from 1 to `n` (inclusive)
a) If `n` is divisible by the number, add the number to the divisors list
3) Return the divisors list
⚠️ Common Mistakes
A number is "evenly divisible" when the remainder of the division is zero. How can we check for that in python?