This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Steps | |
# 1. Install the gem sinatra | |
gem install sinatra | |
# you you skip rdoc and ri using | |
# gem install sinatra --no-rdoc --no-ri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Enter your statements separated by a carriage return, The matching braces will terminate the loop" | |
variables = Hash.new(Hash.new) | |
opening_brackets = 0 | |
closing_brackets = 0 | |
while true | |
variable = nil | |
level = nil | |
value = nil | |
input = gets.chomp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
def smarter_way(unsorted_array, size, sorted_array) | |
maggic_array = Array.new(130) {|i| i = ({ i => 0 }) } | |
unsorted_array.each do |num| | |
maggic_array.each do |hash| | |
if hash.keys.first == num | |
hash[num] = hash[num] + 1 | |
end | |
end |
NewerOlder