I don't understand why for test suite 4 :
a=[0 1 1 1 0 2 2 0 1 1 1 0];
y_correct = [1 1];
I expect y_correct = [1 1 1]
The idea seems to be to return the element that occurs in the longest run, or all such elements in case of a tie. In case 4 there are two longest runs, both with element 1.
Thanks Tim for the explanation . So as the vector [1 1 1] appears twice in test 4 with the unique value 1 , the result must be twice the unqiue value -> [ 1 1]. ok ok thanks again
I have this array as I counted the times it repeats. However, can someone give me a command to pull out the max values with the number to the left? Any advise? The first value in column on the right top doesn't matter as it should always be 1. I try the max command it only shows the max value of 3...:
Great problem. Thank you.
Is there a way to test output without submitting?
I really liked this one
Test 1 is error！
y_correct =[1 2];
This is the best solution I have seen. ????
Why is test 4 like that tho
Tricky one, but enjoyed solving it.
Is this a correct solution?
Why/How does the leading solution (with size 8) even work? -_-
Tricky one.. but enjoyed it.
if a(num_a)==a(next_a) %如果这个数字和后面的数字相等，则n_val+1，并进行下一次循环
Test 1 and 4 are wrong
Could you please comment on this method? It is very unlikely for me as a beginner in Matlab to have such a concise code. You are more than welcome to elaborate here or via my e-mail address firstname.lastname@example.org
Really succinct code. One of the best I saw so far in the contest. @Piero Cimule
Could you check this for me, please?
How else could you solve in any other traditional programming language?
It was not so easy...
i cannot understand
Project Euler: Problem 3, Largest prime factor
Back to basics 21 - Matrix replicating
Split a string into chunks of specified length
02 - Vector Variables 5
Draw a 'Z'.
Crunch that matrix!
How Far Can You Throw Something?
It's going down. We're finding simbers!
There are 10 types of people in the world
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office