quite easy
I bet
a nice practice.
function b = targetSort(a,t)
[m,n]=sort(abs(a-t),'descend');
k=a(n);
for i=1:length(a)
if k(i)>=t
b(i)=m(i)+t;
else if k(i)
I don't why this easy problem come at last.
Good one.
well.........simulator is not working.better to think about it
This is well above the average size. I must be missing something that would make this much simpler.
consider using the 'sort' function !!
I find [b,I]=sort(A) is really a useful method!
What?? Strange method to get lowest size.
Should dynamic regular expressions be disabled ? This could be done on about thing !!
Brilliant use of complex numbers to force sort(x) to operate on abs(x)
sortrowsc? Strange I can run this function in R2012b, but I cannot find it in help.
It is a MEX file function called by sortrows. Check it out in the sortrows source code.
You do not need to use the real function
Maximum running product for a string of numbers
1113 Solvers
Calculate the Levenshtein distance between two strings
456 Solvers
Project Euler: Problem 10, Sum of Primes
708 Solvers
Given a 4x4 matrix, swap the two middle columns
516 Solvers
465 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!