How would we know the logic of program at beginging?
How would we know the logic we should use exactly for the program, we code at begining from begineers side?
Like most things you do frequently, it eventually comes off as second nature. Another great idea is to first solve the problem by hand on paper or a white board; I do this a lot and it helps immensly. Pretty much like math proofs
I do just the same as 「ＨＡＰＰＹ ＴＯ ＨＥＬＰ」 mentioned, it does not matter what level of question you are solving but once you solve it on paper then most probably you will be able to solve it using that logic through code as well.