Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'};
alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}
assert(isequal(alphabetize(list),alpha_list))
alpha_list =
1×3 cell array
{'Dagwood Bumstead'} {'Barney Google'} {'Snuffy Smith'}
lName =
3×1 cell array
{1×1 cell}
{1×1 cell}
{1×1 cell}
lName =
3×1 cell array
{'Google' }
{'Smith' }
{'Bumstead'}
alpha_list =
1×3 cell array
{'Dagwood Bumstead'} {'Barney Google'} {'Snuffy Smith'}
|
2 | Pass |
list = {'Harry Truman'
'Dwight Eisenhower'
'John F. Kennedy'
'Lyndon Johnson'
'Richard Nixon'
'Gerald Ford'
'Cleve Moler'
'Ronald Reagan'
'George Bush'
'Bill Clinton'
'George Bush'
'Barack Obama'};
alpha_list = {'George Bush'
'George Bush'
'Bill Clinton'
'Dwight Eisenhower'
'Gerald Ford'
'Lyndon Johnson'
'John F. Kennedy'
'Cleve Moler'
'Richard Nixon'
'Barack Obama'
'Ronald Reagan'
'Harry Truman'}
assert(isequal(alphabetize(list),alpha_list))
alpha_list =
12×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
{'Gerald Ford' }
{'Lyndon Johnson' }
{'John F. Kennedy' }
{'Cleve Moler' }
{'Richard Nixon' }
{'Barack Obama' }
{'Ronald Reagan' }
{'Harry Truman' }
lName =
12×1 cell array
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
{1×1 cell}
lName =
12×1 cell array
{'Truman' }
{'Eisenhower'}
{'Kennedy' }
{'Johnson' }
{'Nixon' }
{'Ford' }
{'Moler' }
{'Reagan' }
{'Bush' }
{'Clinton' }
{'Bush' }
{'Obama' }
alpha_list =
12×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
{'Gerald Ford' }
{'Lyndon Johnson' }
{'John F. Kennedy' }
{'Cleve Moler' }
{'Richard Nixon' }
{'Barack Obama' }
{'Ronald Reagan' }
{'Harry Truman' }
|
235 Solvers
We love vectorized solutions. Problem 1 : remove the row average.
546 Solvers
Change the sign of even index entries of the reversed vector
296 Solvers
436 Solvers
Flip the vector from right to left
2666 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!