Just finished tech screening for Snowflake backend engineer role last week. Got a very weird question:
Implement a key constraint function that takes in a list of referenced rows and a list of keys to insert. Returns if there is a constraint violation.
Spent some time with the interviewer to understand the question (I am not database focused and not interviewing just for a database engineer). So basically I confirmed with the interviewer by just implementing a set to record the referenced rows (just using list of string as inputs to simplify the question) and find violation.
The follow-up question is how to modify the codes for sorted rows (sorted by certain column). And I answered with binary search to find the matching row.
The next follow-up is what if the input file is very big. I answered with chunking the big file and search one by one (with some skipping operation since keys are still sorted)
I am using C++ as my coding language so the question does not make much sense to me (or maybe I still didn't fully undertand the question).
Any clue what the interviewer actually wants for this question?
(Anyway, already failed the interview because of this question)