Previous Google question:
Example:
https://pastebin.com/TLWXeUq0
The idea would be to create a Room class which would correspond to Node
The walls of Room would be the edges (Edge class?)
We will use a BFS approach here as it gives O(n) complexity for this problem
class Door{
Room next;
int keyId;
}
class Room{
int keyId=-1;
boolean has_treasure = false;
Room(int keyId){
this.keyId = keyId;
has_treasure = false;
} }
I am struggling to formulate the code from scratch, any help with code is appreciated
Found some problem doscussion here
https://www.careercup.com/question?id=5097647948955648#:~:text=You%20are%20a%20game%20developer%20working%20on%20a%20game%20that,opened%20by%20a%20unique%20key.