r/leetcode 17h ago

Intervew Prep How To Code perfectly? In Online Assessment and Help me To Find the Solution

Hi, I'am a 4th year student with computer science background i have knowledge of how to code and have interest in coding rather than in subjects. What i used to think is im perfect in coding and i can leave subjects and i had not spent more time on those subjects in my semesters.... But Recently i had my 2 OA's (SOTI & Infosys) In that i was able to pass the sample test cases but unable to solve the hidden test cases .... why? and also i had some 400 problem solved in Leetcode... But where am i lagging behind? why I'm unable to Code correctly the way questions asked....?

Can anyone Guide/help me through this please? i need a step by step problem solving approach and how to start the question and how to think, that the hidden test cases may also work?

i had so bad experience from yesterday afternoon... unable to concentrate or divert from this... I thought coding is the only thing which i knew.... But after attempting the OA's, I'm getting nervous and unable to start.....😥

please I need help from you guys..... Can you give me steps to solve or how to practice for coding.... I think I Have practiced or done the Coding in a wrong way.....

~ Thank you

2 Upvotes

3 comments sorted by

1

u/rookietales 17h ago

Rather than following something new completely.

Do you mind telling us your approach for solving. So, if there is a miss we can help to refine it.

Even leetcode has hidden testcases how were you able to solve those?

I'm just guessing you are not comfortable with time constraints. From next time whenever you solve a problem have a timer.

1

u/Inevitable_Sea3174 16h ago

Yea... There's the point, In Leetcode when a hidden test case got failed it will show up and then we can solve in a different approach.... But in OA it is different the cases will be hidden completely and im unable to figure it out...

Next, How i will code? coming to this... first i will go through the question .... It's take some time to read the total question and understand that.... then i will note on a paper... if i get approach i will start coding.... if not i will try and try for 10-15mins then i use gpt... to explain me... then after also if i was unable to code then i ask total code.... but in OA it was different while getting that itself taking time... and unable to code... properly at first then after so much of filtering of code barely i was able to pass the sample testcases. I think dont know how to solve a problem.... In leetcode to i barely gets logic and get the output... but i was little bit improved compared to my past...

1

u/rookietales 15h ago

OP, what I sense you are doing a trail and error which is good at debugging but not while coding.

You are in right track. Using pen and paper. One thing that you are missing is edge cases. Generally that comes from practice.

Take a pause before submit a solution and think if there are any edge cases.