Cody

Recent Activity

1 – 50 of 10,101

Asif Newaz submitted a Comment to Problem 1268. Penny flipping - calculate winning probability (easy)

https://en.wikipedia.org/wiki/Gambler%27s_ruin#Fair_coin_flipping

on 13 Dec 2019 at 18:38

Asif Newaz submitted a Comment to Solution 2056983

why it is showing--"While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service'' ...

on 13 Dec 2019 at 17:36

Iskender Gencer submitted a Comment to Solution 2056732

The pass criteria should not be specific to the number of spaces that are left instead of the omitted state names. This beats the purpose of the exercise. There should either be no extra spaces left in the solutions, or it should not be specific to how the author of the challenge solved the problem.

on 13 Dec 2019 at 13:41

KULWINDER KAUR submitted a Comment to Solution 2056230

Nice problem

on 12 Dec 2019 at 20:16

Miles Walker submitted a Comment to Solution 2055983

Works, but is horribly inefficient especially for higher p...

on 12 Dec 2019 at 16:20

Stone Liu submitted a Comment to Solution 2055839

I think i should learn regular expression

on 12 Dec 2019 at 14:03

Nando Käslin submitted a Comment to Solution 1101535

weird flex, but ok

on 12 Dec 2019 at 12:47

Stone Liu submitted a Comment to Solution 2055191

two NaNs are not equal to each other, using isnan to detect NaNs. Thus, a = a(all(a==a,2),:); a = a(~any(isnan(a),2),:); a(any(a~=a,2),:) = []; a(any(isnan(a),2),:) = [];

on 12 Dec 2019 at 6:45

Asif Newaz submitted a Comment to Problem 45221. cofactor matrix

@william .. sorry man-- i overlooked .. i've corrected it now. sth related to the determinant function- matlab provided that answer. i didn't see that

on 11 Dec 2019 at 1:18

Asif Newaz submitted a Comment to Problem 752. Is X a Fibonacci Matrix?

https://youtu.be/lTHVwsHJrG0

on 10 Dec 2019 at 20:40

Artiom Vernik submitted a Comment to Solution 2052986

Is there a shorter way?

on 10 Dec 2019 at 11:11

Pauli Huusari submitted a Comment to Solution 2052604

This should be quite straightforward but at 2a.m. my brains are not working 100%. ;)

on 9 Dec 2019 at 23:48

Pooja Lalan submitted a Comment to Solution 2041010

Hi Asif, the output from the function is expected to be only the minimum value of vector y; whereas your code returns both - the minimum value of y and also the corresponding t. This is causing the last test to fail. I will modify the tests to make it clearer. You should pass the tests if you set m = ymin

on 9 Dec 2019 at 16:51

SherlockSecure Bugcrowd submitted a Comment to Problem 7244. Times 3 problem

nice problem

on 9 Dec 2019 at 12:05

Parv Verma submitted a Comment to Problem 2024. Triangle sequence

It was a really great problem to solve. For me doing the steps as mentioned on paper helped a lot for proper visualization of the problem, and to understand the flow. Thanks Tanya Morton for the problem exercise.

on 6 Dec 2019 at 18:54

William submitted a Comment to Problem 45221. cofactor matrix

Why is there a value 4.000000000000001 in the cofactor matrix of problem 4? The matrix is composed entirely of integers, so the cofactors should all be integers as well.

on 5 Dec 2019 at 19:09

Paresh yeole submitted a Comment to Solution 2047384

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

on 5 Dec 2019 at 14:40

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

Nicolas Douillet submitted a Comment to Problem 45220. Find triangles from edge

I actually realize this problem looks like a lot to my second problem, "Find a common edge" ( https://fr.mathworks.com/matlabcentral/cody/problems/45218-find-a-common-edge ) ...

on 3 Dec 2019 at 20:49

Nicolas Douillet submitted a Comment to Problem 45220. Find triangles from edge

Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.

on 3 Dec 2019 at 20:35

Nicolas Douillet submitted a Comment to Problem 45219. Find edges from a vertex

Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.

on 3 Dec 2019 at 7:41

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 Problem 1639. SHIFT REGISTER

the test suite answer is wrong

on 2 Dec 2019 at 20:08

Adam Jelínek submitted a Comment to Problem 953. Pi Estimate 1

The principle is described here: https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80

on 2 Dec 2019 at 16:15

Martin Thomas submitted a Comment to Problem 2946. Where is she?

Really, you should have a link between what directions you're looking, looking up and backwards aren't technically a pair, should really be look up/down or forward/back.

on 2 Dec 2019 at 12:33

Nicolas Douillet submitted a Comment to Problem 45218. Find a common edge

Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.

on 1 Dec 2019 at 18:02

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

Nicolas Douillet submitted a Comment to Problem 45217. Find a common vertex

Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.

on 1 Dec 2019 at 17:14

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

Jean-Marie Sainthillier submitted a Comment to Problem 42875. Assignment Problem

Good problem. How to proceed with larger matrix (where permutations are too expensive) ?

on 29 Nov 2019 at 15:20

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

Asif Newaz submitted a Comment to Problem 824. Set the array elements whose value is 13 to 0

damn man!!! i just tore my head off to solve this then i figured there is a very very simple way to do that

on 25 Nov 2019 at 14:36

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

nireas liapis submitted a Comment to Problem 247. Arrange Vector in descending order

i comment for the challenge

on 23 Nov 2019 at 20:00

David Verrelli submitted a Comment to Problem 44819. Relative pose in 2D: problem 1

The %% is an issue because it is so poorly documented and hence poorly understood (or even not understood). The following seems to be how it works. [Note: in the following I will use "↲" to indicate the end of a line in the code/output.]       ~~~~~~~~~~ Creator writes this TEST SUITE: ~~~~~~~~~~ ----- commandA↲ commandB↲ ↲ %% test 1↲ commandX↲ ↲ %% test 2↲ commandY↲ -----       ~~~~~~~~~~ Cody RUNS the following tests: ~~~~~~~~~~ Test 1: (i) commandA; (ii) commandB; and (iii) commandX. Test 2: (i) commandA; (ii) commandB; and (iii) commandY.       ~~~~~~~~~~ Cody DISPLAYS the following output: ~~~~~~~~~~ ----- %%commandA↲ commandB↲ ↲ %% test 1↲ commandX↲ ↲ [output from commandX only]↲ ↲ %% test 2↲ commandY↲ ↲ [output from commandY only]↲ ↲ ----- ~~~~~~~~~~       Notice: (i) any commands before the first %% [namely commandA and command] are run at the beginning of every test; (ii) output of any commands before the first %% is suppressed [never displayed]; (iii) for the player, a spurious "%%" is displayed on the first line of the Test Suite if there were any commands before the first "%%".       It is actually a very clever structure for Problem Creators writing a Test Suite. Therefore I'd be keen to retain it. See e.g. https://www.mathworks.com/matlabcentral/cody/problems/44655       The annoyances are: (i) lack of documentation; (ii) suppression of output; and (iii) insertion of a spurious "%%" in the display. Although none of these three issues affect the running, they cause a lot of confusion and misunderstanding.

on 23 Nov 2019 at 2:24

Wei Wang submitted a Comment to Solution 1491584

wo hao nan a

on 23 Nov 2019 at 1:31

Willion Bird submitted a Comment to Problem 66. Find the two-word state names

What do this problem mean ?

on 22 Nov 2019 at 6:16

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

1 – 50 of 10,101