Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Using DFS to check if I can remove a specific "node"

I'm working on a tile based city builder. Currently the way the data is stored is an array of objects. Within each object, it has information like its location and other tile properties,

State.land = [
  { location: [0, 0] },
  { location: [0, 1] },
  { location: [1, 1] },
  { location: [1, 2] },
  { location: [-1, 0] },
]

The player can click on spots next to existing locations which would push a new object with the location into the land array.

Currently working on a delete method. You can only delete a land if all adjacent lands can reach [0, 0] ([0, 0] is not delete-able)

Im thinking this would be a good way to implement a nice path finding algorithm and DFS was the first that came into mind.

I've only ever implemented DFS while leetcoding but it's been awhile since I last done it. Would DFS be a good option for this problem?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!