Cody

Problem 45434. Weighted Names

Solution 2390868

Submitted on 27 May 2020 by William
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x={'Col Theodore Roosevelt', 'Gen Ulysses S. Grant','Cap Abraham Lincoln'}; y_correct ={'Gen Ulysses S. Grant','Col Theodore Roosevelt','Cap Abraham Lincoln'}; assert(isequal(weighted_names(x),y_correct))

2   Pass
x={'Jean-Marie Sainthillier','Asif Newaz','Binbin Qi','Alfonso Nieto-Castanon','J. S. Kowontan'} ; y_correct ={'Jean-Marie Sainthillier','Alfonso Nieto-Castanon','J. S. Kowontan','Binbin Qi','Asif Newaz'}; assert(isequal(weighted_names(x),y_correct))

3   Pass
x={'Ser Gerold Hightower','Prince Lewyn Martell','Ser Barristan Selmy','Ser Arthur Dayne','Ser Jaime Lannister'}; y_correct ={'Ser Barristan Selmy','Ser Gerold Hightower','Ser Jaime Lannister','Ser Arthur Dayne','Prince Lewyn Martell'}; assert(isequal(weighted_names(x),y_correct))

4   Pass
x={'Eddard Ned Stark','Rob Stark','Brandon Stark','Aegon Targaryen VI','George R. R. Martin'}; y_correct ={'George R. R. Martin','Eddard Ned Stark','Aegon Targaryen VI','Brandon Stark','Rob Stark'}; assert(isequal(weighted_names(x),y_correct))

5   Pass
x = {'william','Ser Arthur','William II','William III'}; y_correct ={'Ser Arthur','William II','William III','william'}; assert(isequal(weighted_names(x),y_correct))

6   Pass
x={'Harry','Harry Potter','Harry James Potter','Ms. Hermione Granzer','Albus Percival Wulfric Brian Dumbledore'} ; y_correct ={'Albus Percival Wulfric Brian Dumbledore','Harry James Potter','Ms. Hermione Granzer','Harry Potter','Harry'}; assert(isequal(weighted_names(x),y_correct))

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!