perhaps you should specify that y is in the order of the first occurence of each unique element of x
This would be a better problem if unique and sort functions were not allowed
Nice problem!
Solution without using sort(.) or unique(.) .
Solution without using sort(_) or unique(_) .
Note 1) this solution does not use sort() anywhere :) 2) the more elegant "stable" is not available for unique in pre-2012 MATLAB.
Increment a number, given its digits
562 Solvers
Project Euler: Problem 3, Largest prime factor
384 Solvers
Back to basics 22 - Rotate a matrix
764 Solvers
360 Solvers
556 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!