Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda