So we now know when there is a deletion, addition, or substitution, we'll need to account for that. The key to understanding the levenshtein edit distance is that we'll use an array matrix to account for the n^2 possible transformations.
Here's a nice visual to grok how we'll apply this logic across a matrix:

Image credit to https://www.python-course.eu.
xxxxxxxxxx147
console.log('PASSED: ' + "getEditDistance('busa', 'ebcar') should return 4");var assert = require('assert');function getEditDistance(a, b) { return '';}class Graph { constructor() { this.adjacencyList = new Map(); this.verticesCount = 0; } addVertex(nodeVal) { this.adjacencyList.set(nodeVal, []); this.verticesCount++; } addEdge(src, dest) { this.adjacencyList.get(src).push(dest); this.adjacencyList.get(dest).push(src); // push to both adjacency lists } removeVertex(val) { if (this.adjacencyList.get(val)) { this.adjacencyList.delete(val); }OUTPUT
Results will appear here.