How to interview at top tech companies in Ruby

Yash Ranadive

I have been coding in Ruby for last 6 years and it is my strongest language by far. However, as I was preparing to interview at top tech companies, I faced a big question - which programming language should I use?

If you ask this question to your recruiter, they will likely say that the language doesn’t matter. But how true is that? I had doubts that the simplicity and almost english like syntax of Ruby would actually be confused by interviewers as pseudocode. I imagined interviewers like to see working code and not pseudocode. I was afraid my choice of Ruby would hurt my chances of getting in.

7 interviews and 3 offers (2 small 1 large company) later I’m convinced that choosing Ruby wasn’t such a bad decision after all. As long as you are an expert in one language, the choice of language shouldn’t be much of an impediment.

In this blog post I’ll share solutions for some frequently asked programming problems in Ruby. Ruby code samples for interviews are really sparse and websites like Leetcode, Geeks For Geeks tend to be heavier on Java and Python solutions. I was often stuck wondering how a problem could be implemented in Ruby efficiently. It is always good to have a reference solution to work from.

Here we go!

Trees and Tree Traversal Basics

Find if a tree is balanced

Common Ancestor of Nodes in a Tree

Max Depth of a Tree

Two Sum Problem

Find if any two numbers in an array sum to a target value

Three Sum Problem

Check if a binary tree is valid

Unique Permutations


Topological Sort (For Graphs)

Insertion Sort

Merge Sort

Trie Implementation (using Hash)

Square Root of a Number

Power of a Number


Sorting Cheat Sheet

Heap Time Complexity

Rubyisms (Quick ways to do frequently tasks)

Some Interesting Facts

Yash Ranadive

Written by

Engineering @Facebook. Founder @GrepPage. Data Eng. @Lookout. Web, Search, 3D. Dog Parent.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade