Whenever you see a problem:

Step 1

Understand the problem.

inputs
outputs
constraints
edge cases

Step 2

Solve manually with a small example.

Step 3

Write brute force solution.

Step 4

Ask:

What repeated work is happening? Can I store results to avoid repeating work?

Step 5

Use a data structure:

Common ones:

hashmap
set
stack
queue
heap
linked list

Time Complexity (Very Important in DSA)

Ask:

How many operations happen?