Samsung Electronics interview question

Some LeetCode-style questions of easy-medium difficulty.