Interviewing at Uber — Junior Dev Phone Interview Technical Questions

Adi S
Adi S
Feb 5 · 3 min read
Source: theladders.com

I recently spoke to a junior web developer that had a tough time with Uber’s phone interview. I thought I would share the problems we worked on and see what the Medium community thinks!

Since this is for full stack roles let’s stick with Javascript solutions. Similar to my other blog posts that consist of technical questions, I will post my solution in the comments after some of you have had a chance to give it a go.

Medium

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.

If the fractional part is repeating, enclose the repeating part in parentheses.

Example 1:

Input: numerator = 1, denominator = 2
Output: "0.5"

Example 2:

Input: numerator = 3, denominator = 1
Output: "3"

Example 3:

Input: numerator = 2, denominator = 3
Output: "0.(6)"

Some people have been asking for some hints:

  • There is no crazy high level math here, just remember back to your long division days
  • Try a couple of examples to recognize a pattern. With 1/3 the repeating part is easy, but how about something like 4/333. Do you see a pattern?
  • After trying those you will also notice once the remainder starts repeating, so does the divided result.
  • Edge cases can hurt you here. Really think about your test cases and list out as many as you can. Test, test and test your code!

Medium

Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order.

Return the intersection of these two interval lists.

(Formally, a closed interval [a, b] (with a <= b) denotes the set of real numbers x with a <= x <= b. The intersection of two closed intervals is a set of real numbers that is either empty, or can be represented as a closed interval. For example, the intersection of [1, 3] and [2, 4] is [2, 3].)

Example 1:

Input: A = [[0,2],[5,10],[13,23],[24,25]], B = [[1,5],[8,12],[15,24],[25,26]]
Output: [[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]]
Reminder: The inputs and the desired output are lists of Interval objects, and not arrays or lists.

Note:

  1. 0 <= A.length < 1000
  2. 0 <= B.length < 1000
  3. 0 <= A[i].start, A[i].end, B[i].start, B[i].end < 10^9

*I have also seen this one asked at Facebook*

Try these two out and see how you would do on an Uber phone interview for junior devs! Developers in my previous blog posts, Interviewing at Google — Javascript Assessment, Microsoft Online Assessment and Interviewing at Facebook — On-Site JavaScript have been very helpful and there is some good discussion/solutions in the comments.

Good Luck and see you in the comments!

JavaScript in Plain English

Learn the web's most important programming language.

Adi S

Written by

Adi S

JavaScript in Plain English

Learn the web's most important programming language.

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