These practice problems are meant to be downloaded, written, and run on your own computer. You can download this whole prep-work repository, including the practice problems, in ZIP format.
The instructions for the practice problems are written inside the spec
files (in the spec
directory); check those for instructions on what
you are supposed to do. You can run the specs for an individual
problem like so:
bundle exec rspec spec/00_nearest_larger_spec.rb
You can write your code in the corresponding files in lib
(e.g.,
lib/00_nearest_larger.rb
). I've filled them out with a blank method
for you. You'll need to write the code to make the specs pass.
Work through the problems one by one; when you complete writing the code, run the spec to check your work. Make sure to look at the results it returns; look at which individual tests fail and then start to figure out why.
My advice is to solve them all once, then put your solutions away and solve them all again a day later. You should build a good, intuitive grasp of the techniques needed to solve these problems.
I've included solutions, but you shouldn't look at those until you finish a problem (or get totally stuck).