The requirements for this problem are unclear and / or the tests are poor. If there are 2 equal lengths of the same number, e.g. [ 2 2 2 1 1 2 2 2 3 4 5], the expected result from the test is [2 2]. Why not just [2]?
Or if the input is [ 3 3 3 2 2 2 1 5 4] and the routine returns [2 3], why is this wrong? The test expects output of [3 2]...
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.