This would be improved by a richer test set to avoid solutions based on simple lookup of the test cases.
I think we can assume the entries are all positive integers, but it would be good if that was stated in the problem specification.
Definetely agree. Adding more tests in the test suite and rescoring the solutions will elmiminate solution under a score of 92
My 33 is a terrible solution. Please add more test cases.
Tim's 80 is very good and my 83 is also valid. Addition of a common random value at an end overlap will eliminate chicanery. v=randi(100) [1 2 3 v] [v 4 5].
Created legitimate size 72.
Added a few more tests. Thanks for the comments!
s1 = [3 1 4 1 5 9 2 6 5 3 5];
s2 = [9 2 6 5];
s3_correct = [3 1 4 1 5 9 2 6 5 3 5]; maybe is not correct ;-)
Problems 1 and 2 have alternate solutions:
1) [5 4 3 1 2 3 4 5]
2) [1 0 1 7 7 7 6 0 1]
Did I just solved this myself? Toughest for me so far. Thanks!!!
This did not make me sleep. Most difficult so far, took me some few hours lol.
Try this with: [ 1 2 3], [3 1 2]
Finds: [1 2 3 1 2]
Should find: [3 1 2 3]
hello, have you ever tried s1 = [ 1 2 3 ], s2= [1 2]?
Nice :) I was trying to think of clever ways to use convolution, but didn't manage. This should be the leading solution instead of the lookup based on the test cases..
Come on. Put in a general solution rather than gaming the solution set.
Test for balanced parentheses
Convert a numerical matrix into a cell array of strings
We love vectorized solutions. Problem 1 : remove the row average.
Convert given decimal number to binary number.
Check that number is whole number
Return the largest number that is adjacent to a zero
Find the sum of all the numbers of the input vector
The Goldbach Conjecture
Sort a list of complex numbers based on far they are from the origin.
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