Formlabs interview question

They asked me a LeetCode question, easy to medium.