The Approach for Logic Building Skills:
Solve pattern-recognition based problems because it will improve the visualization of logic. It is one of the fundamental steps of computation thinking.
After some level of practice, your mind will work like a mini-debugger where you could able to visualize the flow of data and how different variables are taking values at different points of execution of code.If a problem is asked in the interview or anywhere else, then we should be able to get the logic correctly in a single chance,