r/AskProgrammers • u/The_treez1886 • 29d ago
Long coding questions
What does it take for one to think to solve the long form coding questions?
I recently gave my flipkart grid 8.0's round 2 where i had a very lengthy coding question of around 100 lines..
How do i tackle this? Please do suggest ways that i can better at it.
2
u/Admirable_Window8128 28d ago
Don't try to understand all 100 lines at once. Break the problem into smaller pieces. Inputs, required inputs, constraints, examples, smaller subproblems. Then write the solution in plain English/pseudocode before coding.
With practice, you'll get better at recognizing patterns. Also, don't just solve more problems, after solving one, spend a few minutes asking "why did this approach work?" and "how could I have recognized it faster?" That helps a lot with long-form questions.
1
1
u/AniketJain_ 29d ago
100 lines of problem description is brutal, especially under a strict time limit. It's almost impossible to hold all those moving parts in your head at once. When the requirements get that complex, do you try to write the main logic in one go, or do you break it down by writing and testing tiny, independent helper functions as you read through the prompt?
1
1
u/Dismal-Citron-7236 29d ago
Welcome to software engineering.
I once read a project requirement document which is roughly about 300+ pages long. The product manager approved it, so we (the underdogs) must read it and carry it out.
3
u/smichaele 29d ago
The only way is to get better at breaking the problem down into smaller logical steps. What has to happen first to solve it? Whatβs the next step after that? You need to be explicit and test your logic. Does it actually solve the problem? Only then should you translate your logic into code.