How am I wrong here?
"a = [ ...
1 0 0;
0 0 0;
0 0 0;
0 0 0;
0 2 3];
r_correct = 5;"
My code says 2, I think it's correct, what am I missing?
It wants the number of the row with the most nonzeros.
Thank you Tim! I feel like a fool, but that'll teach me to read the requirements more carefully. Hopefully.
Great Problem!
nice
Love this one
Piece of cake
nice
easy :) but nice
Could you please check my solution.
How come the solution example 2, 3 and 4 have r= 3, 5 and 4. When it should have been r = 4, 3 and 1.
As these are the maximum number of zeros in any of the given row.
Can someone please give me a hint on how the solutions are provided so different?
What are these matrices in last 3 test cases? Can someone help
Nice solution!
so happy~
there is a bug i the code
input a = [1 0 1 1 ; 9999 0 0 0]
output 2
there is a bug in the code
input a = [1 0 1 1 ; 9999 0 0 0]
output 2
r = max(sum((a==0)'));
Original solution I created by digging through documentation was x=a~=0; y=sum(x,2); [M,I]=max(y); r=max(y). Solution had a size of 31 so I compressed it into it's current version.
in case number 3 and 4 total number of element is also less than your correct fullest row output
How does this thing is possible
I did it!
(^^;)
this is a terrible solution, someone help.
Could you tell me how you did it?
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!
test suite is not ok
what is the problem here ? it works on matlab and gives the correct row
2 things: You forgot to set your output (so add a line r=ix, or change the r in the first line into ix.
and you changed the function name so it doesn't recognize it.
Your solution does work.
Well done.
Is there any way to avoid this for loop??
Yes, a hint: compare with zeros matrix and count (sum) the nonzero elements in this logical matrix.
Can you please tell how did you do this with the size of 10?
Just again the regexp Cheat, I guess!
I can't believe, that this is still working... Why don't they ban all the Cheating possibilities?
It's completely unfair, to all other players!
The regexp cheat kind of shadows the "normal" solutions.
can you show that '10'?
I did not mean to like this, but the 'Unlike' button does not work!
looks very strange
I can't believe I used a trick I learned from Javascript...
I tried to optimize my solution as much possible as I could, still my code size was 45, any idea what would be there in the leading solution of this problem which has code size as 11 ? Which trick did you use?
Remove any row in which a NaN appears
7253 Solvers
4269 Solvers
532 Solvers
793 Solvers
487 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!