Problem 67. Find common elements in matrix rows
Solution Stats
Problem Comments
-
6 Comments
Any version of "empty" should be acceptable as correct.
For example, intersect can output a 1x0 empty matrix. That should be allowed.
Somehow the assert is triggered if the function returns a [] that has been "sorted".
If I include that code
if ~isempty(y)
y = sort(unique(y));
end
no assert is triggered. Seem strange!
How can the leading solution be 0??
Following many comments, the Test Suite should be amended to check for an empty output vector using "isempty", rather testing for equality to []. Such an amendment is appropriate, and would not break any of the previously submitted successful solutions. —DIV
Test cases with an empty result now test against isempty().
intresting
Solution Comments
Show commentsProblem Recent Solvers2663
Suggested Problems
-
Find the sum of all the numbers of the input vector
50127 Solvers
-
What is the next step in Conway's Life?
655 Solvers
-
Find state names that end with the letter A
1186 Solvers
-
Rotate and display numbered tile
346 Solvers
-
Matlab Basics - Absolute Value
629 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!