Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created May 26, 2012 15:41
Show Gist options
  • Select an option

  • Save hitode909/2794355 to your computer and use it in GitHub Desktop.

Select an option

Save hitode909/2794355 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
queue = ['マークザッカーバーグ']
chars = queue.first.split(//)
for i in 0...chars.length-1
for j in 0...chars.length-1-i
chars[j+1],chars[j]=chars[j],chars[j+1] if chars[j] > chars[j+1]
now = chars.join('')
queue.push(now) if now != queue.last
end
end
queue.reverse.each{ |line|
puts line
}
@loveybot

Copy link
Copy Markdown

Yay Ruby!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment