Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class WeightSort
  6. {
  7. public static string orderWeight(string strng)
  8. {
  9. var weights = strng.Split(' ')
  10. .OrderBy(num => num.Sum(x => (int)char.GetNumericValue(x)))
  11. .ThenBy(num => num);
  12.  
  13. return String.Join(" ", weights);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement