Share your strategy for approaching known problems fast

I have been doing LC for some time now and have good grasp of basic data structure implmentation. I can implement Stacks, Queues, Tries and other structures. However, I have seen I struggle with writing custom implementation in given x mins of time. For example., I am writing Trie to find largest common prefix. So, 80% of the problem code depends on Trie implementation and rest 20% depends on recursive traversal to find prefix. What is your strategy to speed up basic Trie implementation ?

Strategy 1: Have a basic implmentation up in your sleeves which is not going to change and practice it. So you can get basic implementation done in say 15mins of typing. Giving you enough time (next 20 mins) to implement custom logic ?

Strategy 2: You have fundamentally understood and your base implementation varies everytime. But you type fast and you know your implmentation works.

Let me know which one is better to speed up the problem solving ?

Comments (1)