Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Recent Activity

Gergely Patay submitted a Comment to Problem 2635. Higher! Lower!

The misplaced comment line in the first test case breaks the test suite (at least for "conventional" solutions).

1 hour and 11 minutes ago

Ramoflaple submitted a Comment to Solution 550812

Never thought for-loop can be used for a matrix.

3 hours and 42 minutes ago

Nafus submitted a Comment to Solution 696912

Why is this not working?

4 hours and 22 minutes ago

Ramoflaple submitted a Comment to Solution 696726

hardly read it.Never thought a function_handle can be created like this.

8 hours and 1 minute ago

Ramoflaple submitted a Comment to Solution 181121

I finally figure out that you use '+length(list)' to index the second column of the list.

8 hours and 11 minutes ago

Grant III submitted a Comment to Problem 42405. Divisible by 3

Thanks for the comment. I'll be adding a few more problems to this set in the near future to round out and finish up the "divisible by N" approach.

on 6 Jul 2015 at 14:55

Ramoflaple submitted a Comment to Solution 674471

efficient idea

on 6 Jul 2015 at 12:56

Ahmad Shalabi submitted a Comment to Problem 4. Make a checkerboard matrix

simple Tricky

on 6 Jul 2015 at 9:39

Ramoflaple submitted a Comment to Solution 331577

Could you explain to me what's the function of '@' in your solution ?

on 6 Jul 2015 at 9:08

Ramoflaple submitted a Comment to Solution 696204

brilliant solution! I used 'switch...case...' structure to judge 'type'.

on 6 Jul 2015 at 1:24

Varoujan submitted a Comment to Problem 325. 2 b | ~ 2 b

Tricky problem - fools the solver with the function name...

on 5 Jul 2015 at 15:18

Amin Ghazanfari submitted a Comment to Solution 551534

Nice one, really wanna find the shortest answer

on 5 Jul 2015 at 4:57

LY Cao submitted a Comment to Solution 695695

haha,??@cmd also has access to variables in the current as well as its parent,but ?@cmd doesn't.

on 5 Jul 2015 at 1:15

Alfonso Nieto-Castanon submitted a Comment to Solution 695695

a small follow-up: I replicated this behavior (both in R2008b and R2015a) and regexprep dynamic ${ } operator seem to have access to *both* variables in the currently active workspace as well as in its parent workspace... never would have guessed that, thanks LY!

on 4 Jul 2015 at 20:55

Alfonso Nieto-Castanon submitted a Comment to Solution 695695

+1 Nice cheat! I cannot really figure this one out. Seems like regexprep has access to a variable outside of its current workspace? (I am not on my computer right now, is this cody-specific or does this replicate in other settings?)

on 4 Jul 2015 at 17:50

Ramoflaple submitted a Comment to Solution 695994

If I can't view a smaller solution, how can I improve myself ?? I really want to view the better answers.

on 4 Jul 2015 at 16:49

Ramoflaple submitted a Comment to Solution 693235

when you delete one row of B, the size of B changes. your solution works with an assumption that the size of B won't change.

on 4 Jul 2015 at 16:40

Ramoflaple submitted a Comment to Problem 23. Finding Perfect Squares

Agree with Mattias. the length of input vector should be 2 or larger.

on 4 Jul 2015 at 16:08

Ramoflaple submitted a Comment to Problem 33. Create times-tables

Agree with the above

on 4 Jul 2015 at 15:41

Nicholas Hortance submitted a Comment to Solution 695873

Once again ive used a for loop only because it seems so much simpler. The more I do these I see how each person has a different approach to a problem which I think is very cool. Thanks for the problem!

on 4 Jul 2015 at 2:09

Christian submitted a Comment to Solution 695673

Sorry, but I still don't understand the "correct" answer for x = 3 ??? It should be a 3 x 3 Matrix. I doubled the size of my solution with an if-loop to get around this.

on 3 Jul 2015 at 8:55

Swapnil Kulkarni submitted a Comment to Solution 551534

Nice use of recursion !!

on 3 Jul 2015 at 7:22

Terry submitted a Comment to Problem 33. Create times-tables

Apparently the Cody Team can't make a times table. :-p

on 3 Jul 2015 at 7:21

Mission:Tall submitted a Comment to Problem 33. Create times-tables

Agree with Mr.Alfonso ; Test#2 is incorrectly defined

on 2 Jul 2015 at 22:32

Jan Orwat submitted a Comment to Problem 42405. Divisible by 3

Solved problems before reading comments and must agree with Alfonso. "divisible by N" approach worked nicely through all of them.

on 2 Jul 2015 at 7:26

Mark Matusevich submitted a Comment to Solution 694859

Not really a solution, more like a "white flag" regarding this direction.

on 1 Jul 2015 at 20:26

Gedeon submitted a Comment to Solution 694661

wake up

on 1 Jul 2015 at 17:39

MD. Muhtady Muhaisin submitted a Comment to Solution 694543

can anyone suggest how to improve the size of the code?

on 1 Jul 2015 at 15:53

Nicholas Hortance submitted a Comment to Solution 693998

I really liked this problem. I know that I took a very long approach to it but in time I hope to improve it. I have had a lot of practice with for and while loops which is why I have taken this approach.

on 30 Jun 2015 at 15:39

Jean-Marie SAINTHILLIER submitted a Comment to Problem 42421. reverse a string

Because it works even if you don't reverse anything...

on 30 Jun 2015 at 12:59

Jean-Marie SAINTHILLIER submitted a Comment to Problem 42438. row removal

In your test, x is a row vector.

on 30 Jun 2015 at 12:56

Alea88 submitted a Comment to Problem 33. Create times-tables

Agree with Mr.Alfonso ; Test#2 is incorrectly defined

on 30 Jun 2015 at 8:43

vaibhav hosur submitted a Comment to Problem 42421. reverse a string

whats the problem if its palindrome?still it works

on 30 Jun 2015 at 6:11

vaibhav hosur submitted a Comment to Problem 1581. Area of rhombus

describe the problem fully.

on 30 Jun 2015 at 6:09

Alfonso Nieto-Castanon submitted a Comment to Problem 42418. Divisible by 16

perhaps less interesting but I guess you could do the same with powers of 5, iff the last X digits of a number are divisible by 5^x, then the entire number is divisible by 5^x...

on 29 Jun 2015 at 21:19

Alfonso Nieto-Castanon submitted a Comment to Problem 42418. Divisible by 16

@James: nice trick! (and I guess the proof arises from 10^x being always exactly divisible by 2^x, so "iff" also applies?)

on 29 Jun 2015 at 18:22

Mark Orloff submitted a Comment to Solution 693235

Can anyone tell me why matrix B is not being returned correctly? If I put it one 'end' further into the loop it returns the matrix each time a row is taken out and the tests fail

on 29 Jun 2015 at 17:24

James submitted a Comment to Problem 42421. reverse a string

Palindromes are so oserasemordnilap

on 29 Jun 2015 at 15:24

James submitted a Comment to Problem 42418. Divisible by 16

Another trick: if the last 4 digits of the number are divisible by 16, the full number is divisible by 16. So far as I know, if the last X digits of a number are divisible by 2^X, the entire number is divisible by 2^X.

on 29 Jun 2015 at 15:02

Ziko submitted a Comment to Problem 42439. write an algebraic expression

please make an effort in proposing interesting problems.the test suite needs to be more robust and this type of problem has already been treated several times.have a look at others players problems before creating your own. A bored cody player!!!

on 29 Jun 2015 at 12:37

Francisco Salgado submitted a Comment to Solution 692537

test # 2 is wrong, as it should be a 3x3 matrix, y_correct for x=3 is: [1 2 3; 2 4 6; 3 6 9]

on 26 Jun 2015 at 19:52

Francisco Salgado submitted a Comment to Solution 692533

Test nr. 2 seems not right: the soluton for x= 3 should be: y_correct = [1 2 3; 2 4 6; 3 6 9]

on 26 Jun 2015 at 19:09

Francisco Salgado submitted a Comment to Solution 692461

x=1:10 do the same.

on 26 Jun 2015 at 17:14

Jeevan Thomas submitted a Comment to Solution 692108

insufficient test case. bluntly assigning initial even number above zero. y_correct = should've been a vector of [2 4]. In test case it's given as y_correct = 2,4;

on 26 Jun 2015 at 9:44

Jeevan Thomas submitted a Comment to Problem 42426. find even number

Expected value given is wrong

on 26 Jun 2015 at 9:43

Jean-Marie SAINTHILLIER submitted a Comment to Problem 42421. reverse a string

Why choose a palindrome in your example ?

on 26 Jun 2015 at 7:18

Grant III submitted a Comment to Problem 42405. Divisible by 3

Also, building a general "divisible by n" routine is a good idea and I had thought about posting that at the end of the group of problems. I just think that it's too big for a standalone problem. There are many problems on Cody that are extremely simple and require no thought (like the recent string of beginner problems). There are also quite a few that require significant time, thought, and/or programming to solve, but they are all worth the same number of points. I prefer to break more difficult problems into simpler modules (just like is done in programming) to provide an encouraging approach, especially to those not already expert in Matlab. There are similarities between many of the problems in this set, but some numbers require quite different methods, such as 7 and 11.

on 26 Jun 2015 at 1:26

Grant III submitted a Comment to Problem 42405. Divisible by 3

I'm not trying to be authoritarian; just providing awareness to interesting mathematical trivia. There are some numbers, such as 7 and 11, for which a range of methods are possible. Without blocking a lot of those basic functions, very easy workarounds can be used, defeating the purpose of trying to optimize your score (akin to regexp, eval, etc. being banned due to defeating the scoring system).

on 26 Jun 2015 at 1:21

Grant III submitted a Comment to Solution 691188

Well, I'll take that as a compliment, then, because your problems are clever and often stump me.

on 26 Jun 2015 at 1:08

Alfonso Nieto-Castanon submitted a Comment to Problem 42405. Divisible by 3

I understand the java restriction, but the rest seem a bit heavy handed. Also the large number of similar problems might encourage solvers to build a general "divisible by n" routine instead

on 25 Jun 2015 at 16:15