Cody has a time-limit of ~50 seconds for your code to pass the whole test suite. Along with being right, your code needs to run in this time frame for you to able to solve a problem.
As for the number of test cases - that is set by the author of the problem. Generally, a large number of test cases is either to (sufficiently) cover a wide array of test scenarios or to challenge people to write efficient code. Or both.
Group
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
why there are so many testcases that caused run time error though my code were right?
Cody has a time-limit of ~50 seconds for your code to pass the whole test suite. Along with being right, your code needs to run in this time frame for you to able to solve a problem.
As for the number of test cases - that is set by the author of the problem. Generally, a large number of test cases is either to (sufficiently) cover a wide array of test scenarios or to challenge people to write efficient code. Or both.