Problem 1933. That's some divisor you've got there...
Solution Stats
Problem Comments
Solution Comments
-
5 Comments
Brilliant, elegant and beautiful...truly pleasing to the eyes. This is what Cody is about. :). On a different note, Solution 1451618, with a size of 74, has an actual performance time of 4582 msec. While, this Solution has 8869 msec. But the problem states that 'Your score will be based on how quickly your script solves the problems in the test suite, rather than the typical Cody size.'. Any explanation on the actual scoring implementation, Bainhome?
Your comment just a chainsaw on my brain...:), first, solutions on this problem's size really baffles me a while,because someone with far more better code skill than me provide lots of code longer than I expected, I am confused about that. Secondly, when I saw your sol.'s size is slightly bigger(which is extremely rare), I have this sneaky smile on my face and close the page as quick as possible. But now I know this problem is about operational efficiency, not size. I'm not in the mood again...:)
But when we talk about operational efficiency, actual time that kinda stuff, I think Sol.1451618 is far more better. Vectoized code deal with large amount data "all at once", and for loop is "one by one", both of them have very different memory burden. and in this particular situation, i.e. very large number, factor... tradtional for loop has a significat advantage.
All above is purely assumption. Viewer discretion is advised.:)
Originally, this problem was scored by how quickly the code solved the problem. The Cody team changed the method of scoring at some point, so the method I used for setting the score proportional to the time spent solving the problem is no longer valid. There are a couple of other problems I have created that have the same issue.
Thanks James. Now I understand. :)
-
1 Comment
That's the fastest solution that I've found.
Problem Recent Solvers30
Suggested Problems
-
2906 Solvers
-
Set some matrix elements to zero
377 Solvers
-
Check if number exists in vector
8760 Solvers
-
Find Index of maximum Value and maximum Value of a vector
157 Solvers
-
Find the square of the sum of the digits of a number
149 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!