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?
if a(num_a)==a(next_a) %如果这个数字和后面的数字相等，则n_val+1，并进行下一次循环
Test 1 and 4 are wrong
Could you check this for me, please?
How else could you solve in any other traditional programming language?
It was not so easy...
What kind of solution is that?
that's a bug of Matlab Cody, the use of ! and regexp.
I don't know why Mathworks has it not corrected.
Can't understand a bit of this code.
i'd really like to see a better solution that mine, one that uses difference equations..mine is size 129 and is just a control loop. Guess i've got to search in solution map.
Stuff the Board
Say something funny
Plot Damped Sinusoid
Make one vector from two others
Generate a Parasitic Number
Should Mr McNugget even get out of bed today?
Iccanobif numbers 1
There are 10 types of people in the world
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