Here are some tips while giving your coding interviews.

# Do study or read or practice all the possible solutions of a problem

Do not just study the optimal algorithm. Study the Brute force algorith too. This will give you better understanding of the optimal solution. And, what are the problems in brute force solution.

# Never try to jump to the optimal solution first

WHenever interviewer asked you a question. Normally candidates jump to the most optimal solutions straight away. Never do that, even if you know the answer. Manytimes it happens that people just remembers the optimal solution, and when asked in interview on how they come up to this solution, or what are your thought process? They have no clue.

Remember, always start with the brute force algorithm. You can just discuss with your interviewer that this is the simplest approach, and there can be better solutions to this. Discuss them one by one. When you give issues in the naive solution, your interviewer understood that you have knowledge about the topic.