Sven Stähs - MATLAB Cody - MATLAB Central

Sven Stähs

18711
Rank
3
Badges
265
Score
1 – 44 of 44

Sven Stähs received Community Group Solver badge for MATLAB Onramp Practice

on 27 Nov 2021

Sven Stähs submitted a Comment to Problem 672. Longest run of consecutive numbers

The problem specifically states that column and row vectors must be supported, but then doesn't have a test for this. I'd suggest changing at least one of the tests to use a column vector. Or maybe add one test where it is asserted that `longrun(a) == transpose(longrun(transpose(a)))`

on 27 Nov 2021

Sven Stähs submitted a Comment to Problem 672. Longest run of consecutive numbers

hm, I don't think the assertion in test 4 is intuitively correct. The problem asks for the number(s) that have the longest consecutive repetitions in the input vector. So there can be multiple numbers having the longest runs (of equal size), but if all those numbers are the same, as in [1 1 2 1 1], surely the answer is "1", not "1 and 1". I can only imagine that's what the implementation turned out to produce and instead of fixing the implementation to fit the problem, the tests was introduced to check for exactly that output ;) Which is fine, you'll always have clients in real life that say they want something and when you roll it out they meant something different, it just bothers me that my nice solution doesn't work because of this ?

on 27 Nov 2021

Sven Stähs submitted a Comment to Problem 44943. Calculate Amount of Cake Frosting

If you're considering trying to get your solution size down to 10 -- like the leading solution -- don't bother! They wrapped all their code in a regex statement so that the code size cannot be calculated anymore (the algorithm only sees the regex call, not what that regex actually does). ANY code you write like this is going to be of size 10 but is not going to be actually faster than the proper solution. Probably the exact opposite in fact.

on 23 Nov 2021

Sven Stähs received Commenter badge for Solution 6842024

on 23 Nov 2021

Sven Stähs submitted a Comment to Solution 6842024

surely wrapping all the code into a regular expression, which hides it from the code size calculation algorithm of Cody, is cheating... This way you can get a size of 10 on nearly any problem. Thanks for messing up the solution chart for the rest of us...

on 23 Nov 2021

Sven Stähs received Solver badge for Solution 6952169

on 23 Nov 2021

1 – 44 of 44
Go to top of page