It's not possible to forbid cheat totally, because Cody can not hide test cases. It's all about Self-discipline.
li haitao: all answers are currently scored as wrong. On the problem edit/update page, please put your own function in the Reference Solution field and test it to ensure that the problem is solvable before updating or making changes to the test suite.
There appears to be something wrong with the test suite--solutions fail the "digit test" even though they do not include 5, 6, 7, 8, or 9.
Hi li haitao,
when I run my solution. It throws the following error in the server.
"While evaluating the solution, the server encountered an error caused by long running MATLAB code. Edit the code if needed and then submit."
When I tested my solution in my pc, it takes two times the execution time mentioned in the test cases.
How to get rid of this server error. Please help.
Hi li haitao,
For my solution, the execution times for test case 9 is 2.0526 and for test case 10 is 22.1447.
Now I delete "digit test", please submit your codes again, please.
Hi Athi , to get rid of this server error, please speed up your codes.
Hi goc3, now I delete the "digit test", and submit a correct solution.
Hi li haitao,
I like this problem very much. I was trying to solve it for 3 three days.
The best running time reached by my solution 1643182 is,
Test Case #9 : 1.7022 sec
Test Case #10: 17.8276 sec
Test Case #11: 15.0268 sec (Random)
Thanks for such a wonderful problem and test case.
Srrickly speaking, it is a cheat solution,because It does not measure the running time of big data.
@li haitao, you are right.
Good problem. However, you might want to try some values in between the powers of 10 (like N=50000, for example) so a cheat like this doesn't work.
"cheat" can not be forbided, unless Cody can hide the test cases.
I was going to suggest a minimum time for your toc to help prevent look-up tables, but you already implemented it. Nice job!
I added digit test to prevent "look-up tables", although it can not forbid cheat totally.
Find state names that end with the letter A
Determine if a Given Number is a Triangle Number
Matrix indexing with two vectors of indices
The sum of the numbers in the vector
Moving Median Absolute Deviation
Exponents in Factorials(hard)
What can you get for exactly amount of money(harder)
Project Euler 249: Prime Subset Sums
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office