brewersfan1976

unusual_lex_order.rb

Jan 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.33 KB | None | 0 0
  1. def unusualLexOrder(words)
  2.     x = 0
  3.     array = Array.new
  4.    
  5.     while (x < words.length)
  6.           array[x] = words[x].reverse
  7.           x = x + 1
  8.     end
  9.    
  10.     array = array.sort
  11.     x = 0
  12.    
  13.     while (x < array.length)
  14.           array[x] = array[x].reverse
  15.           x = x + 1
  16.     end
  17.    
  18.     return array
  19. end
Advertisement
Add Comment
Please, Sign In to add comment