This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pathBetweenPoints = (list, start, end, currPath = []) => { | |
const node = list.find(({ name }) => name === start); | |
currPath = [...currPath, start]; | |
if (node.connections.some((element) => element === end)) { | |
console.log([...currPath, end].join(" -> ")); | |
return; // Hopefully this will break in the shortest path | |
} else { | |
node.connections?.forEach((name) => { | |
if (!currPath.find((element) => element === name)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { | |
StyleSheet, | |
View, | |
Text, | |
TouchableHighlight, | |
Image, | |
TextInput | |
} from 'react-native' |