Problem 36. Find relatively common elements in matrix rows
Tests aren't specifically adapted to this problem. The code for problem 67 (Find common elements in matrix works here).
Absolutely agree with Jean-Marie.
Tests is not good enough.
Not sure if the previous commenters have the same issue that I have, but I dislike that this test-suite makes a difference in how the empty-matrix is defined (See also comments for solution 167825).
I would suggest checking isempty' for the relevant solutions.
Ironically, simply including the example from the problem statement in the test suite would reject the current smallest ("best") solutions.
Indeed, the current leading solutions with size 29 yield only elements that exist in ALL of the rows in the matrix!
This needs another test case.
Many would fail this:
x = [1 1 1 1;2 3 4 5;3 6 7 8];
y_correct = ;
i thought different
The test suit has been updated to check for miscellaneous cases and a reference solution is added.
Solution CommentsShow comments
Problem Recent Solvers1748
Return the 3n+1 sequence for n
Find state names that start with the letter N
Construct an index vector from two input vectors in vectorized fashion
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!