I've actually been pretty happy at my current job and wasn't planning to switch. A Meta recruiter reached out to me a few times, so I figured I'd interview just to see how it would go.
Technical round (25 minutes of SQL + 25 minutes of Python)
I hadn't grinded LeetCode in a long time. The questions weren't too 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 during the interview — even iterating over tuples and iterating over dictionaries felt rusty to me.
The recruiter told me that successful candidates need to pass 3 SQL questions and 3 Python questions. I only managed to fully solve one SQL question and one Python question... but I still want to share the questions here.
SQL:
The SQL question (shared as a screenshot in the original post) really stumped me for a while. I never would have guessed 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 want. You have to multiply by 100.0 — otherwise 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]]):
# you need to write the rest of this function 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…