In my earlier post, we saw what a T-Nut is and how we go about cracking a T-Nut.
We also used our allegorical guideline to crack a typical Little B T-Nut of reversing a linked list.
Let’s see if we can simplify our elaborate guide.
Cracking the T-Nut
As per our analogy of chewing on an unknown fruit, the steps to crack a T-Nut would be as below :
Step1 - Cull the epicarp
- Simplify the problem statement
Jot down the naïve problem statement that you can atleast vaguely comprehend - Extract the buzz words
Pull out all the jargons and buzz words that hit on you and try to connect them together
Step2 - Take the first bite
- Visual Representation
Make it more colorful, vivid and exciting.
Create a visual representation of the problem. - Relatable Examples
Ensure to take relatable examples. If we have never seen such a problem, let’s try to draw parallels with the real world.
If we have seen similar problems, let’s try to keep it as close to our earlier problem as possible. - Analyze the Input Output Samples
Begin by analysing the input and output samples and see if we can catch some rhythm. Catch some logic.
Try to see if we can guess the output, seeing the input. That’s where we would want to start. - Solve it mentally
Let our “pristine brain” take centre stage. Go with the flow and mentally solve it.
We can work the logic around it later.
Step3 - Chew and swallow the bite
- Identify the edge cases
Re look at the samples and try to identify some anomalies or edge cases, apparent in the samples provided. - Create a logical flow
Begin with naïve “pristine brain” approach and see if you can convert that to a programmable logic or a logical diagram. Make tweaks in the thinking if need be. - Retrospect
Let’s keep asking ourselves if we are going towards the goal with our current approach.
Moving fast is useless, if we are moving in the wrong direction.
If the approach seems complicated, let’s give it some rest and try something else.
Step 4 - Take more bites
- Adapt to Change. Take new bites. Try out a new strategy or optimize the current one.
- Law of conservation of thought
Step 5 - Swallow the next bite
A repeat of Step-3
- Sculpt out a sustainable, workable logic.
- Retrospect and evaluate the approach and check if it is taking us towards the goal.
- Bite -> Swallow -> Retrospect
Step 6 - Optimize the final bites
- Identify and work on the constraints
- Litmus test the solution with various edge cases
- Address the NFRs. Evaluate Time and Space Complexities
Step 7 - Perpetual Optimization
- Let go and feel comfortable to start all over again.
- Necessity is the mother of invention. Do what is needed.
- Don’t over engineer. Keep it simple.
Simplified Nut Cracker
If we find ourselves in no man’s land, cracking a obscure T-Nut, with no idea as to how to strike blows, following each of the above steps religiously makes complete sense. It would pave a path for us to move forward.
If you observe, Step 4 and Step 5 are separated from steps 2 & 3, only to enforce the idea of retrospection and feedback in our next logic cycle.
Once this idea is clear, we can observe that the first bite we take, is no different from any other bites.
The process thus, would be simplified as below:
Culling Epicarp
Would be a process of isolating the problem statement from the other verbal gibberish.
Biting
Would be a process of aligning to a known visual representation and devising a strategy to crack the nut.
Chewing & Swallowing
Would be creating the logical manifestation of our strategy and critically evaluating it within the given constraints.
Final Bites
Would involve addressing the edge cases and NFRs
Perpetual Optimization
All of the above would go through a perpetual cycle of optimization
Diagrammatically, this simplified guideline can be represented as below;
Have fun,
Catch you with another T-Nut soon.