brewersfan1976

alphabet_substring.rb

May 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.23 KB | None | 0 0
  1. def alphabetSubstring(s)
  2.     x = 1
  3.    
  4.     while x < s.length
  5.           if s[x].ord != s[x - 1].ord + 1 then
  6.              return false
  7.           end
  8.              
  9.           x = x + 1
  10.     end
  11.        
  12.     return true
  13. end
Advertisement
Add Comment
Please, Sign In to add comment