I've been pretty happy at my current company and honestly wasn't planning to switch jobs. A recruiter from Meta reached out to me a few times, though, so I went into the interview with a just-try-it-and-see attitude.
Technical round (25 min SQL + 25 min Python)
I hadn't touched LeetCode in a long time. The questions weren't super hard, but they were tricky. The interviewer spoke excellent English and gave me a lot of encouragement and hints along the way. I felt so dumb the whole time — even iterating over tuples and iterating over a dictionary felt rusty to me...
The recruiter told me that successful candidates have to pass 3 SQL questions and 3 Python questions total, and I only managed to get one SQL question and one Python question right... Still want to share the questions here for everyone.
SQL:
(There were two screenshots of the actual SQL question here that I can't reproduce, but here's the gist of what tripped me up.) This one stumped me for a good while — I never imagined you could just use the renewal_count column directly. I felt so dumb. You also need to use SUM(CASE WHEN ...), and one thing to watch out for: the numerator needs to be multiplied by 100.0 before dividing by the denominator to get the decimal you actually want. You MUST multiply by 100.0 first, or the result is always 0!
Python:
"""
The library has a summer reading program where students read books to score points.
Each book belongs to a category and is worth a number of points.
Students can score points from up to 3 books, but each book must belong to a different category.
Given a list of books that a student read, calculate their maximum possible score.
"""
def get_max_score(books: list[tuple[str, int]]):
# this is the part you have to finish writing yourself
return
# Test cases:
test1 = [
("Adventure", 5),
("Adventure", 2),
("History", 3),
]
assert(get_max_score(test1) == 8)
test2 = [
("Adventure", 4),
("History", 3),
("Reference", 1),
("Fiction", 2),
]
assert(get_max_score(test2) == 9)
test3 = [
("Biography", 2),
("Biography", 4),
("Science", 3),
("Science", 1),
]
assert(get_max_score(test3) == 7)
test4 = []
assert(get_max_score(test4) == 0)
print("Passed")
Discussion
Loading comments…