Solved LeetCode program · 986 of 1,000
#1362 · Closest Divisors
Original English source
Keep a shared low of 0. Keep a shared high of 0. Keep a shared bestgap of 1000000.
To consider from factor (a whole number) with value (a whole number). The other is value divided by factor. The gap is other minus factor. If factor is at most other and gap is less than bestgap, set bestgap to gap, set low to factor, set high to other.
To inspect from value (a whole number).
For every factor from 1 to value.
If value modulo factor is 0, Consider from factor with value.
Inspect from 9. Inspect from 10. Show low. Show high.
Expected stdout
3 3