+ 1
Memory limit exceeded / exit status -1 ?
I'm currently trying to create a HCF and LCM calculator for any two given numbers, and, when finding the prime factors as a number, i'm trying to return them as a list. however, when i store the returned list into a variable or try to output the contents via iteration, i'm greeted with a "exit status -1" on the repl.it compiler or "memory limit exceeded" on solo learn. i I've read that returning lists or vectors can be quite expensive, could that perhaps be it? and also, what does "exit status -1" mean in general? original code: https://code.sololearn.com/cmF1wRAl0Evz additional info on the program will be commented in the project.
1 Respuesta
+ 2
In your while-loop on line 35, your condition is if num is a prime or not, but you never actually change num so it never becomes a prime number => infinite loop.
I think you just forgot a "num /= index;" after pushing the index into the list.
"exit-status -1" is a general error message, indicating your program was shut down because of an unsuccessful termination status.