I fixed it aparaently the problem was a != if statement, wich was fixed by replacing it with >. Idk why the not equal didnt work and made an inifte loop but its fixed now.
When I click test my code works, I hit attempt and then theres a 12 second wait and then it says that my code took to long to run so it didnt do it. My code isn't that complicated, just a for loop that runs as many times as the input so I dont get why this is happening. Does anyone know what to do if this happens?
I fixed it aparaently the problem was a != if statement, wich was fixed by replacing it with >. Idk why the not equal didnt work and made an inifte loop but its fixed now.
Maybe it's because an infinite loop has been produced
@Trapyy: Please use a spoiler flag when you post code in a comment (I put the flag for you this time).
you need to put the 'return sum' inside your function
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
you need to rethink your algorithm
are you sure you're program is O(n) time complexity?
When I click test my code works, I hit attempt and then theres a 12 second wait and then it says that my code took to long to run so it didnt do it. My code isn't that complicated, just a for loop that runs as many times as the input so I dont get why this is happening. Does anyone know what to do if this happens?