Category: Interview Tuesday

Learn coding interview questions, answers, and approaches.

Build an ATM Dispensing Method in Ruby

This guide walks through how to build out the common Ruby coding interview question: how to build out an ATM dispensing method. Summary Implement an ATM method that properly dispenses the correct denominations to a user. Exercise File Code File Exercise Description Build out a method that takes two arguments: the total amount of money requested and the denominations that can be returned. And return the count of how many bills of each denomination should be returned to a user. Example Data Input 245, [20, 10, 5] In this example, 245 is the total amount […]

Code Interview Question: Build a High-Low Game in Ruby

This Ruby coding problem tests your ability to implement conditionals, work with user input, and generate random numbers. Summary Build the High/Low guessing game in Ruby where a user attempts to guess a number and the program lets them know if they need to guess higher or lower. Exercise File Code File Exercise Description This needs to be a terminal game that initially prompts the user to guess a number, you will also need to generate a random number so the answer will be different for each game. The start of the game should look […]

Reverse the Letters in a String Without Using the Reverse Method in Ruby

In this coding exercise you’ll re-create the reverse method in Ruby. You are required to build a method that reverses the characters in a string and returns the reversed values. Summary Build a method that reverses the characters in a string without using the reverse method. Exercise File Code File Exercise Description You will need to perform monkey patching and open up the String class in Ruby. From there create a method called alt_reversethat reverses the characters in a string without calling the reverse method provided by Ruby. Sample Use “Hi there”.alt_reverse # “ereht iH” […]

Coding Interview Question: Hashed FizzBuzz in Ruby

This coding exercise tests your knowledge of the popular FizzBuzz developer interview question, with a twist. In this version of FizzBuzz you’ll build a hash data structure filled with FizzBuzz data. Summary Build a FizzBuzz program that stores the FizzBuzz data in a hash data structure. Exercise File Code File Exercise Description Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”, and for values that are multiples of three and five print out “FizzBuzz”. […]

Ruby Coding Interview Question: Build a Dynamic Sum Method

This coding exercise walks through how to build a method that takes a single integer as an argument and builds a sum of all of the integers counting up to the argument value. Summary Build a program that sums all of the integers up to, and including any value passed in as an argument. Exercise File Code File Exercise Description The program should be able to take in a single argument of an integer, and output the sum of all of the integers up to the argument’s value. Sample Input 10 Sample Output 55 Real […]

Ruby Coding Interview Question: Creating a Palindrome Method in Ruby

In this coding exercise we’ll walk through how to properly create a palindrome method in Ruby, including a discussion on working with case insensitive comparisons. Summary Create a method that checks to see if a word is a palindrome or not. Exercise File Code File Exercise Description Given a string such as: “tacocat” Check to see if the word is a palindrome. A palindrome is a word that is spelled out the same way if you reverse the letters. Also, ensure that the palindrome method is case insensitive. Example Input/Output “tacocat” # true “Tacocat” # […]

Ruby Coding Practice: Parsing a String with Multiple Matches

Summary Build a program that utilizes regular expressions to extract a specific set of integers from a string in Ruby. Exercise File Code File Exercise Description Given the following strings: Web IconHTML & CSS100% Command LineLearn the Command Line100% Ruby IconRuby – Ruby IconRuby50% Rails IconLearn Ruby on Rails100% Git IconLearn Git100% SassLearn Sass20% JQuery IconjQuery1% Angular JSLearn AngularJS 1.X100% Javascript IconLearn JavaScript55% Write a program that iterates over the strings and outputs the final integer value, storing it in an array. Input [ “Web IconHTML & CSS100%”, “Command LineLearn the Command Line100%”, “Ruby IconRuby50%”, […]

Classroom Live Lecture: Git Deep Dive for Developers

In this live lecture we walk through how to work with Git to build and manage applications. Link to the git cheat sheet.

Live Lecture: Deep Dive into RSpec

In this live lecture I walk through various ways that you can utilize the RSpec testing library in pure Ruby and a production Rails app. RSpec Code Resources Code from lecture

Ruby Coding Lecture: Split, Join, Each, and Map Methods

In this lecture I take a deep dive and walk the devCamp code students through how to use the Ruby methods: Split Join Each Map The code for the lecture is below: Split str = “Star Wars, Luke, Darth, Yoda” p str.class p str.split(/, /).count [“Star Wars”, “Luke”, “Darth”, “Yoda”] p str.split(/, /, 2).count [“Star Wars”, “Luke, Darth, Yoda”] first, *rest = str.split(/, /) p first p rest api = “@=>Posts={title: asdfasdf, title: zxcvzxcv}, @=>Comments={body: qwe, body: vcxfgsfd}” p api.split(/@=>/) [“”, “Posts={title: asdfasdf, title: zxcvzxcv}, “, “Comments={body: qwe, body: vcxfgsfd}”] Join arr = [“Star Wars”, […]

By Daniele Zedda • 18 February

← PREV POST

By Daniele Zedda • 18 February

NEXT POST → 34
Share on