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 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 email@example.com
Could you check this for me, please?
How else could you solve in any other traditional programming language?
It was not so easy...
Project Euler: Problem 9, Pythagorean numbers
Multiples of a Number in a Given Range
kmph to mps
Return area of square
MATLAB Basic: rounding IV
Fun with a compass
It's Happy! It's Fun! It's Happy Fun Hyperball!
It's going down. We're finding simbers!
Give me Hamming on five, hold the mayo
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