So I am solving question 3 from here https://www.olympiad.org.uk/papers/2016/bio/bio16-exam.pdf↵
↵
I have two pieces of code, one in Python and one in C++.(Both attached below as pictures)↵
↵
↵
C++ -> https://pastebin.com/bHkhZcZ6↵
Python -> https://pastebin.com/8G4BZQx6↵
↵
↵
Although the both pieces of code seem to be employing the same logic, the Python one seems to be a lot faster than C++. ↵
↵
An example test case could be ↵
-> 614700 3643 90149 ↵
-> (It should output 18) ↵
↵
Please can someone tell me why this is the case?
↵
I have two pieces of code, one in Python and one in C++.
↵
C++ -> https://pastebin.com/bHkhZcZ6↵
Python -> https://pastebin.com/8G4BZQx6↵
↵
↵
Although the both pieces of code seem to be employing the same logic, the Python one seems to be a lot faster than C++. ↵
↵
An example test case could be ↵
-> 614700 3643 90149 ↵
-> (It should output 18) ↵
↵
Please can someone tell me why this is the case?