How to solve Leetcode questions -
1. Keep a practice to solve 1 question every single day. EVERY SINGLE DAY.
2. If you're not able to think about the logic after spending 10 min, ask ChatGPT to explain the logic for this question. Don't see the code. Just the logic for the solution.
3. Try to code it yourself. For a programmer, coming up with the logic is 1 part and actually being able to code it is another. Your logic building will take time. But first you should be a good coder to code any logic, however complex it is. Both these skills develop separately.
4. If you're not able to code it fully by yourself. Then either ask ChatGPT to code it and then look at its code and try to complete yours. Or give your incomplete code to ChatGPT and ask it to complete it for you by keeping the same structure.
5. If you code it and some test cases fail, then try to debug it yourself by dry running it for the failed test case. This is not as important for the interview as in an interview, you won't be executing the code but just writing it in a paper or Google doc. But still this gives you confidence and makes you understand the entire code properly.
6. If you're not able to debug, then you may again give it to ChatGPT and the test case and ask what's the issue. Understand the issue and then try to fix it by yourself.
7. Once you solve a question, write the logic of the code in that solution in comments. So that, before any interview you may easily revise 200-300 questions in 3-4 days by just going over the question and its logic.
Remember, Leetcode is a marathon, not a sprint. It takes time and a lot of patience.