Cody

Recent Activity

1 – 50 of 5,161

Paresh yeole submitted a Comment to Solution 2047384

I know I have adapted code according to test cases. But was stuck in this one.

15 hours and 20 minutes ago

Miles Walker submitted a Comment to Solution 2045741

Uses the formula for perpendicular distance of a point to a line when the line is not axis orthogonal.

on 4 Dec 2019 at 17:01

Miles Walker submitted a Comment to Solution 2045288

Interesting! This error stems from using "Ix" in both function and sub-function. As I test my code in scripts not contained within a function I was missing it. Why are parameters made available to sub-functions by default?

on 4 Dec 2019 at 16:04

Jack Shadow submitted a Comment to Solution 2043151

It was not so easy...

on 3 Dec 2019 at 1:22

Asif Newaz submitted a Comment to Solution 2041010

why it is failing..i dont understand..it gives no indication why assertions have failed

on 1 Dec 2019 at 17:31

Asif Newaz submitted a Comment to Solution 2040914

increase the tolerance value..i had to be very specific to match the result

on 1 Dec 2019 at 16:10

Payam Morsali submitted a Comment to Solution 2040190

could you tell me what is the leading solution that is the size of 12

on 30 Nov 2019 at 18:19

David Verrelli submitted a Comment to Solution 1721380

Neat solution using some additional mathematical knowledge.

on 30 Nov 2019 at 12:33

tkd submitted a Comment to Solution 2035340

I broke Cody server with this. function f = fib(n) a=[0 1]; indx=n-1; if n==0 f=a(1); elseif n==1 f=a(2); else while indx <= n a(indx+1)=fib(n-1)+fib(n-2); indx=indx+1; end f=a(n); end also my size is -1 shouldnt I win?

on 26 Nov 2019 at 3:04

Raymond MacNeil submitted a Comment to Solution 2034291

LOL @y set as the output. I was nearly convinced this problem was invalid.

on 25 Nov 2019 at 6:03

Wei Wang submitted a Comment to Solution 1491584

wo hao nan a

on 23 Nov 2019 at 1:31

Gustavo Morales submitted a Comment to Solution 1619892

that's a bug of Matlab Cody, the use of ! and regexp. I don't know why Mathworks has it not corrected.

on 22 Nov 2019 at 4:52

Qiaowen submitted a Comment to Solution 2031576

i suppose the answer has some problems

on 22 Nov 2019 at 3:39

Wei Wang submitted a Comment to Solution 2030010

Missing a line? a = zeros(n)

on 21 Nov 2019 at 15:14

Bora Canbula submitted a Comment to Solution 2027939

you are sooo right

on 19 Nov 2019 at 18:36

David Motson submitted a Comment to Solution 1619892

What kind of solution is that?

on 19 Nov 2019 at 9:23

David Motson submitted a Comment to Solution 1917805

I don't understand how this solution works? The return value is not set?

on 18 Nov 2019 at 12:06

Raymond MacNeil submitted a Comment to Solution 2026266

whoops, don't know how I managed to confuse .^ with .* for a bit there ---I was like, "What's WRONG?"

on 18 Nov 2019 at 10:53

Raymond MacNeil submitted a Comment to Solution 1877827

out = any(ismember(a.*a, a))

on 18 Nov 2019 at 10:51

Raymond MacNeil submitted a Comment to Solution 1985237

Only need: out = x([1 end]) This is legal even if length(x) == 1, because in that case, x(1) == x(end)

on 18 Nov 2019 at 9:12

Raymond MacNeil submitted a Comment to Solution 2026148

Well, I guess my understanding that string is defined using (" " , i.e. double quotations) is incorrect. I thought class string was formally distinguished from char (defined using ' ', i.e. single quotes). I should have looked at the test-suite.

on 18 Nov 2019 at 9:08

Gustavo Morales submitted a Comment to Solution 1230037

a vector as v = [3,2,7,0,5] will show you your code's bug

on 18 Nov 2019 at 1:10

Gustavo Morales submitted a Comment to Solution 1719302

Hi. A vector with ones or zeroes as v = [3, 1] will show the bug in your code.

on 18 Nov 2019 at 1:08

Gustavo Morales submitted a Comment to Solution 1877827

a vector 'a' with elements 0 or 1 will show the bug in your code

on 18 Nov 2019 at 1:04

Gustavo Morales submitted a Comment to Solution 1879664

0 and 1 elements in a will show the bug in your code

on 18 Nov 2019 at 0:59

Gustavo Morales submitted a Comment to Solution 1439856

Thats right> construct c thru concat operator [..] instead of indexing it. Index "i" doesn't care because it don't care the size of the sequence.

on 17 Nov 2019 at 15:07

Gustavo Morales submitted a Comment to Solution 1840594

the assignment c = [c,a]; must be out of the else clause, but still inside of the while block.

on 17 Nov 2019 at 15:02

dan submitted a Comment to Solution 2024819

novice lalala...

on 17 Nov 2019 at 7:48

Gustavo Morales submitted a Comment to Solution 216021

Great: to transpose a char row into a char column makes the work...

on 17 Nov 2019 at 3:09

Gustavo Morales submitted a Comment to Solution 517324

great! learning the existence of arrayfun

on 17 Nov 2019 at 2:58

Romain Demory submitted a Comment to Solution 487060

nice

on 15 Nov 2019 at 21:19

Gustavo Morales submitted a Comment to Solution 1274855

fliplr flips all elements in rows. The problem say only 'flip' the first one and the last one

on 15 Nov 2019 at 19:09

Gustavo Morales submitted a Comment to Solution 1652052

And................ obviosly "Undefined function or variable 'C1'." You have made assignments in wrong order. Your code says: A(:,1)=C1 Should say: C1 = A(:,1);

on 15 Nov 2019 at 19:07

Gustavo Morales submitted a Comment to Solution 1652052

Could fail the last test, if A has only 1 column: c = 1 Bad indexing (r,c-1) == (r,0) You got to catch case c = 1 and don't swap at all

on 15 Nov 2019 at 19:05

Gustavo Morales submitted a Comment to Solution 1204954

Should be the best for now!

on 15 Nov 2019 at 16:04

Miles Walker submitted a Comment to Solution 2021683

Cheated with 1...: 1000 - 0001 = 999. 999 - 999 = 0 y = inf; No?

on 14 Nov 2019 at 19:31

Miles Walker submitted a Comment to Solution 2021587

I've never cared so much about America

on 14 Nov 2019 at 18:32

Chris Armstrong submitted a Comment to Solution 942496

I don't think that simply using tf=rem(n,2) should be allowed, its implicit casting which isn't a good thing to depend on.

on 14 Nov 2019 at 8:31

Gustavo Morales submitted a Comment to Solution 1360252

I think is the best solution!

on 13 Nov 2019 at 19:29

Gustavo Morales submitted a Comment to Solution 1337594

this solution just pass the test suite, but if there would be uppercase consonants, will fail! The variable letter must contain the uppercase consonants too!

on 13 Nov 2019 at 19:17

Miles Walker submitted a Comment to Solution 2017318

Pretty kooky final test...

on 13 Nov 2019 at 8:49

Kiam Heong Kwa submitted a Comment to Solution 2017112

The following solution, which is correct, is marked wrong. function a = checkerboard(n) a = ones(n); a(2:2:end) = 0; end

on 13 Nov 2019 at 5:04

David Motson submitted a Comment to Solution 2015845

I discovered using a for loop doesn't work - too slow. Then I realised that randi can generate the required vector, doh!

on 12 Nov 2019 at 13:46

Jason Walker submitted a Comment to Solution 1980061

nice!

on 11 Nov 2019 at 13:31

P Santosh Kumar Patra submitted a Comment to Solution 2012623

Easy way to learn concatenation :)

on 10 Nov 2019 at 17:52

Bob Lin submitted a Comment to Solution 2003102

Watch out! Martix size!

on 5 Nov 2019

David Motson submitted a Comment to Solution 1936837

Surely these ! echo "function assert(~) " >./assert.m solutions are not valid?

on 4 Nov 2019

Payam Morsali submitted a Comment to Solution 2001066

why this isn't working here? it works on my laptop; function ind = subset_sum(v,n) k=dec2bin(0:2^length(v)-1); b=k.*v; l=find(sum(b')==n); m=k(l,:).*(1:length(v)); ind=m(m>0); end

on 3 Nov 2019

Xiangyu Liu submitted a Comment to Solution 1812725

Thanks

on 29 Oct 2019

David Hill submitted a Comment to Solution 1993615

Very nice solution.

on 28 Oct 2019

1 – 50 of 5,161