DEV Community

Himanshu Gupta
Himanshu Gupta

Posted on

1

How to solve a DSA problem

Hers is Golden Word
Without go into water we can not become swimmers.

These are the steps that you should follow:

  • Get a question (Start with simple question)
  • Understand the question completely(Try Until it clear to you).
  • Get an estimate of the required complexity(Ask to interview) .
  • Come up with edge cases based on the constraints.
  • Come up with a brute-force solution. Verify if it will pass.
  • Optimize, verify and repeat this step.
  • Dry-run your solution on the sample tests and edge cases.
  • Code and test with the sample tests and edge cases.
  • Submit. Debug and fix, if the solution does not work for yo.

Image description

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay