Hello Alfonso. It's a pleasure to see you again. An idea why my Solution 548586 doesn't pass the test in Problem 2793 ?
Hi Jean-Marie, thanks, it is a pleasure to be back! In my opinion that does not work simply because the Matlab session where your solution is being evaluated is not a "clean" (just started) matlab session. Rather the testsuite will be evaluated by one of several Matlab servers available at any given timepoint, and while the variable space is cleared, and the directory structure is deleted before each evaluation there are many other properties (like the state of random streams, functions in memory, etc.) which are not reinitialized and will be influenced by the particular server's history of evaluated solutions (e.g. this is what allows hacks like freepass to work)
edit: Sylvain solution here shows that I was wrong above, and the random seeds *are* reinitialized before running the testsuite, only that not to their 'default' state but rather likely by using rng('shuffle') (I have to look through Cody code to see if I can confirm this but that would be consistent with the observed behavior)
With apologies for the hack. The proper solutions are more elegant.
I'm confused why this works on my local version of Matlab but not the Cody server version?
Thanks Alfnoso for the comment... ;-)
this would count as a hack, but just because it is original a hint (if I am interpreting correctly): right idea wrong slash
Yes, it was a try...
Oh! I forgot that the Cody servers run under linux... ;-)
ha, that would also work :)
O_o but... why????
At the risk of giving the game away, go read the documentation of if.
Implement a ROT13 cipher
Find the sum of the elements in the "second" diagonal
Back to basics 23 - Triangular matrix
Symmetry of vector
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
the fly, the train, the second train, and their Zeno's paradox
love is an n-letter word
Five steps to enlightenment
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