Facebook | Phone | Mismatched sentences & Fill an Array
Anonymous User
3266
Apr 18, 2020
May 10, 2020

I've gotten a lot from this community and want to give back. These are questions from my phone screen, for a data engineering role. The key to my success was thinking out loud, to give the interviewer insight into my thought process as I coded.

Also! When I got stuck on special cases (e.g., syntax stuff I'd ordinarily Google), I wasn't scared to ask the interviewer for help... for example, I wasn't sure if .split() happened in place or if I needed to create a new object to store the result, and I just asked.


(Python Q) Mismatched sentences

Write a function to identify the words that appear in one sentence but not the other (case sensitive).

Example

  • string 1: "This is the first sentence"
  • string 2: "And this is the second sentence"
  • output: ['This', 'first', 'And', 'this', 'second']

(Python Q) Fill an Array

Given an array with 'empty' spots, fill those empty spots with the preceding number.

Example

  • input array = [8, None, 3]
  • output array: [8, 8, 3]

SQL Qs

For the SQL portion, I was given a database schema and asked to calculate ratios from the provided four tables. I wasn't given any details on the contents of the tables, besides a listing of their column names. I was just left to ask questions about what I needed. Themes throughout my solutions:

  • use of WHERE statements to filter (and wildcard characters to filter string-valued fields)
  • ordering results by the output of an aggregation function
  • using JOINs to pull together multiple tables (e.g., numerator in one table and denominator in another)
Comments (8)