These questions vary in level from quite easy to fairly hard.
It is possible to answer most questions with a couple of lines of code, and just a few methods. Feel free to use the Ruby docs and / or Stack Overflow as part of your learning.
If you find you're writing a long, complex solutions, there's probably a better way. Get it working and then start to refactor your answer to provide a simpler solution.
Once you feel that you've got as far as possible, let us know by sending a Tweet @MA_Apprentices with a link to your code challenge repo. We'll select up to 25 people to progress. They'll be fast tracked through to an interview for Makers Academy Apprenticeships.
Bonus points will be awarded for a completed approach.md
file being submitted. This file should outline the approach you took to solve the challenges. Nothing too long - 50 to 100 words should be enough 👍
============
Get setup to code on your own machine
- Visit http://installrails.com/ to setup your computer. You only need to do this once
- Once you're setup move on to the bit that says "Already setup to code"
Already setup to code on your machine?
- Fork this repo over to your Github
- Clone it down to your computer
- Get the first test passing
- Send up the changes and a pull request
The simplest alternative:
- Fork this repo to your own Github
- Get invited to our hosted cloud platform (we need your email address for this)
- Once setup on the platform create a Workspace
- Run
bundle install
in the terminal area - Answer the first question in the questions file
- Commit the answer and then follow these steps to commit your code
- $
git status
- $
git add .
- $
git commit -m "Insert a message"
- $
git push origin master
- At this stage you should see the changes in your own Github account
- $
Once you've answered the first question
- Send a pull request straight away (yes - after your first answer)
- Answer the second question (in the challenge section)
- Commit the answer and push it up to your repo
- and repeat to get into the habit of learning both Ruby and Version Control
... the pull request will automatically update itself!
We've written a bunch of tests to help you answer the code. To check your progress as you code along, use this command in your terminal:
$ rspec questions_spec.rb
Good luck
- Try and get the RSpec tests to pass (but not by cheating - i.e. hardcoding the expected value)
- Do as much as you can
- You shouldn't need any extra libraries or gems
- You cannot change the tests
- The cleaner your code the better!
- Googling is fine!
-
Use the ruby docs http://www.ruby-doc.org/
-
Try and break down the problems into smaller chunks. For e.g. if you google "How to select elements in an array that start with a", you won't have much luck. Try and find out a) how to select certain elements in an array, b) how to test if a string starts with an 'a'
-
Don't forget Enumerable (advanced array methods)
-
Read our Onboarding guide - the ultimate book on everything we look for in our candidates.
-
Don't panic 😉