Question: I have some technical interviews coming up. I am struggling to think like a programmer. Whenever I get an assignment, I always ask for help from professor or tutor and explain how to get started and such. But I have a feeling that I would not able to answer technical questions if given. I do not want to say, "I don't know" on every question I do not know. Any suggestions? How can I improve? Sometimes, I used internet to find the solution to my problem, for example, how to store in an array, I googled that and see how it's done. But tends to forget them easily.

Thanks.

Answer: 
You need to practice coding to think like a programmer in the same way you need to practice anything to be comfortable with it.

1) Write code

There are plenty of places online that will give you a bunch of problems to practice on and ponder upon. I like <http://codekata.com/> but there are several others. You also have previous homework that you have the solution to. Having done it once, try to do it again from memory. If you need to peak, then peak. Repeat until you can code it from memory. Being comfortable with recalling how to do fundamental tasks will help you look at a problem and immediately start to see possible solutions; if you don't master the building blocks, what do you expect to build?

2) Read code

Read code online, read code in your text books, read code your peers write, read code strangers write... Just read you some code. This is especially helpful if the person decides to implement a particular solution in a different manner than the way you would have gone. Ask yourself, why did then go this route? Is it better, worse? Does it matter?

3) Know a language's best practices

Each programming language has its own way of doing things like array/list iteration, loops, condition checking etc. There's a lot of overlap, but a certain programming language can make a particular programing task very easy or very tedious. For example, list comprehensions in python can save you a lot of time, but not if you don't know about them.
That's pretty simple : practice. A lot. That's the only way you're gonna get better. Your example of forgetting simple coding methods such as storing data in an array is typical from someone who hasn't produced enough code in his life. Sure, if you read how to do it on Google and copy-paste it once to complete your homework you won't remember it. If you do it twenty times in various exercices, you will.

I assume you're (or soon to be) fresh out of college. Interviewers don't expect you to know everything (of course they don't expect you to be completely ignorant either). Don't lie to them. Just work so that there soon will be only a few questions you have to answer "I don't know" to, and you'll be fine