Cześć
it would seem that the recently added test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Apparently the Cody Team can't make a times table. :-p
Agree with the above
For those who wish to solve anyway: Make a correct solution that works with tests 1 and 3, and then hardcode an if with n==3 at the end to make solution 2 work
Sorry for the typo, I just fixed the test#2.
Good question!
How can people solve problem like this with a size 10 ?
Easy one
Easy one!
For a simple solution check out the matlab function kron
1
nice question
nice
good for beginners
why do you guys say nice question
so many possible solutions, just boils down to simplicity or creativity
moderately easy nice.
Challenging
That one was unique
m = [1:n]'*[1:n];
K = kron(1:n,1:n)
m = reshape(K,n,n)
Good Problem
function m = timestables(n)
y(1,1:n)=1:n;
y(1:n,1)=1:n;
for i=2:n
for j=2:n
y(i,j)=y(1,j)*y(i,1)
end
end
m = y;
end
a = repmat(1:n, n, 1);
m = a .* a';
or
m = (1:n) .* (1:n)';
m = (1:n)'*(1:n);
m = [1:n]'*[1:n];
what is the true leading solution?
Please help me out,cant find out the error
I think the error is pretty clear. line3: column=1:1:n; line4:row=1:1:n.
besides, 1:n just fine, the "1" in the middle is quite not necessary.
what if i use 1:n and 1:1:n?both are same right? The step size is 1 for both the case. Tried what you said but Test suit fails again
two equal sign in line 3&4 are missed: this is fatal error, fix that, in my computer seems work fine. and 1:n is another problem, it can pass even you don't change it. nontheless, 1 in the middle is redundant. it CAN be removed, not like you have to.
How could you solve this by size 10?
hahahaha,hello~~
very easy
nice
On my matlab this code works for all the test, but here it fails, why?
m = reshape(1:n^2,[n,n])';
Moreover How can I see better solutions of the problem that I solved, so I can improve my Matlab skills?
Thank you very much for your attention
Sorry, I missed a ;-)
(^^)v
Yeah,I did it.
Test solution 2 is incorrect, should be:
y_correct = [1 2 3; 2 4 6; 3 6 9]
current solution isn't even square...
The test suite is broken for this problem.
The second test should say y_correct = [1 2 3; 2 4 6;3 6 9];
can someone please tell me what I've done wrong here pls. Thanks
You've done nothing wrong; the solution to Test Suite #2 is incorrect.
No need to apply loop here, m=[1:n]'*[1:n] works fine.
function m = timestables(n)
m=(1:n)'*(1:n);
end
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]
Test nr. 2 seems not right: the soluton for x= 3 should be:
y_correct = [1 2 3; 2 4 6; 3 6 9]
lol
I tried on my matlab, it works.
this solution is correct... the answer for test #2 is incorrect.
Nice question. Good reminder how vector multiplication works.
Good
Pretty Cool
Duh! Thanks for reminding me how matrix multiplication works
good to learn with matrix scalar multiplication
it's correct for any value !!!!!
What, this is so weird!!!! Nice job
Missing semicolons...
l just wonder is it a real boring thing (times table),that we need to program it,for exam.12*12=144,almost everybody who atteded high school can answer,2^10=1024;25*25=625,13*13=169;14*14=196;15*15=225;it is such an easy thing that we needn't to make a table,we can calculate it out once we see such an multiplication
like your solution its very concise but there is one problem for me you have used '* for multiplication, can you please tell why?
function m = timestables(n)
for i=1:n
for j=1:n
m(i,j)=i*j;
end
end
%apparently this doesn't work even though MatLab says it works for any size
Brilliant!
After the solution I come up with ends up in the middle of the graph I feel disappointed. But then I learn there's a command that does something I didn't know about and I feel better about myself because I learned a new command!
amazing!
very elegant :)
nice :)
interesting approach, very smart!
838 Solvers
6442 Solvers
570 Solvers
303 Solvers
There are 10 types of people in the world
429 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!