Christian Schröder - MATLAB Cody - MATLAB Central

Christian Schröder

5
Rank
91
Badges
52027
Score
1 – 50 of 5,298

Christian Schröder submitted a Comment to Problem 60850. Matrix Diagonal Sum

Nice problem! But test cases 5 and 6 appear to be wrong: the answer should be 117, not 135.

on 16 Apr 2025 at 6:46

Christian Schröder submitted a Comment to Problem 60839. List the notes of a major scale

Nice problem, Chris! One small point: in your description of a major scale, I think it should be three whole steps after going from E to F, not two.

on 6 Apr 2025 at 18:43

Christian Schröder submitted a Comment to Problem 60835. Prime Numbers

The test suite's broken, and the problem cannot be solved without hacking. BTW, if you fix the test suite, I'd also suggest adding more test cases.

on 31 Mar 2025 at 20:55

Christian Schröder submitted a Comment to Solution 14584578

Classic.

on 28 Mar 2025 at 18:49

Christian Schröder submitted a Comment to Problem 60826. Identify Similar Rows in a Matrix Based on Sequence of Non-zero Elements

Thanks, William. I'm unsure how the problem description could be understood such that there is ever a case where a row (even an all-zero row) is not similar to itself, but unless and until the author provides clarification we may never know what's intended. To the author: I would also suggest that when checking whether a matrix is empty, you use isempty(...) rather than isequal(..., []) since the latter also checks the size, and [] is specifically a 0×0 matrix.

on 22 Mar 2025 at 10:47

Christian Schröder submitted a Comment to Problem 1092. Decimation

@Jason the key realization that'll address all the concerns you raise is that you shouldn't think of decimation as happening in discrete rounds to begin with. Instead, imagine that the prisoners are standing in a circle, and Carnage Maximus is standing in the middle, pointing to each living prisoner in turn. When the number of times he has pointed is divisible by kill_every, then that prisoner is taken away to be executed, and the decimation process continues. The circle is now smaller - but Carnage Maximus is ignorant of this and simply keeps on pointing. In other words, in the example, you start with this sequence of prisoners (this is what you'd get if you pointed to each person in the circle in term, without ever taking anyone away): 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 ... After 3, 6 and 9 have been removed - with Carnage Maximus still pointing at the empty spot where 9 used to stand -, the circle is now 1 2 4 5 7 8 . 10 1 2 4 5 7 8 10 1 2 4 5 7 8 10 1 2 ... and the . is where Carnage Maximus is pointing. Moving on, the 3rd and 6th prisoners he points to next are 2, 7, so the circle is now 1 4 5 . 8 10 1 4 5 8 10 1 4 5 8 10 ... Now the 3rd and 6th prisoners he'll point to next are 1 and 8, after which the circle is 4 5 . 10 4 5 10 4 5 10 ... Then 5 is removed next, 4 . 10 4 10 4 10 ... and after that 10 is removed, leaving 4. I hope that this clears up what's happening and why it does, in fact, make perfect sense!

on 20 Mar 2025

Christian Schröder submitted a Comment to Problem 60826. Identify Similar Rows in a Matrix Based on Sequence of Non-zero Elements

I'm not sure I understand your notion of similarity. Suppose we've got rows r1 and r2, and let r1n and r2n denote r1 and r2 with trailing zeros removed. By your first condition, for r1 and r2 we must have that r1n equals r2n. But since the remainder of r1 and r2 is zeros, this implies that r1 and r2 are also equal, yet this is clearly not what the test suite expects. I don't think that this can be cured by reading the problem description differently either. In particular, your test suite indicates that for a zero matrix, the result should be empty, yet I cannot conceive of a sensible notion of similarity by which the first row is not similar to itself. I also would like to point out that in your solution template (which does not pass the test suite) what the code does is at odds with what the comments say it does.

on 20 Mar 2025

Christian Schröder submitted a Comment to Problem 60822. Calculate the Number of Moles

Mass is moles times molar mass, not moles divided by molar mass - or perhaps you meant to write Moles = Mass (g) / Molar Mass (g/mol). Also, the test suite expects solutions to return 0 when a molar mass of zero is provided, not Inf.

on 19 Mar 2025

Christian Schröder submitted a Comment to Problem 70. Alphabetize by last name

@Brent the extra space is be immaterial: it's outside the string. The problem with your earlier non-scoring solutions is the "F." in "John F. Kennedy", which your solutions mistakenly removed

on 17 Mar 2025

Christian Schröder submitted a Comment to Problem 44958. Crop an Image

@Rich imcrop() is part of the Image Processing Toolbox, and toolboxes are not available on Cody.

on 12 Mar 2025

1 – 50 of 5,298
Go to top of page