The test cases are as follows:
smallestCommons([1, 5]) should return a number.
smallestCommons([1, 5]) should return 60.
smallestCommons([5, 1]) should return 60.
smallestCommons([1, 13]) should return 360360.
smallestCommons([23, 18]) should return 6056820.
Everything works except the last test case. When I plug that test case’s numbers into the program it gives me a potential infinite loop error. How is it possible that I have a potential infinite loop for only one test case?
You do not have an infinite loop, but because your algorithm is not as efficient as it could be (and takes longer than the FCC code runner expects), the FCC code runner assumes there could be an infinite loop. Read more about this issue and how you can temporarily disable the infinite loop protection from the link below.
Ah, I figured it could be that the algorithm was taking too long and hence the program was treated as an infinite loop. I just didn’t know for sure. Thank you for the speedy answers! I’ll try to make the algorithm more efficient and if that takes too much time I’ll just disable the infinite loop protection!