Created
February 13, 2021 09:02
-
-
Save roblav96/42275d0e64dc97a59f03281579df209b to your computer and use it in GitHub Desktop.
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
// Type some code -> | |
console.log("oO08 iIlL1 g9qCGQ ~-+=>"); | |
@real fox.quick(h){ *is_brown && it_jumps_over(dogs.lazy) } | |
0123456789 ABC.DEF.GHI.JKL.MNO.PQRS.TUV.WXYZ ß <= ¶^$#% >= | |
export function longestCommonSeq(wordX: string, wordY: string) { | |
const m = wordX.length | |
const n = wordY.length | |
const l: Array<Array<number>> = [] | |
for (let i = 0; i <= m; i++) { | |
for (let j = 0; j <= n; j++) { | |
if (i === 0 || j === 0) { | |
l[i][j] = 0 | |
} else if (wordX[i - 1] === wordY[j - 1]) { | |
l[i][j] = l[i - 1][j - 1] + 1 | |
} else { | |
const a = l[i - 1][j] | |
const b = l[i][j - 1] | |
l[i][j] = a > b ? a : b // max(a,b) | |
} | |
} | |
} | |
} | |
function updateGutters(cm) { | |
var gutters = cm.display.gutters, | |
__specs = cm.options.gutters | |
removeChildren(gutters) | |
for (var i = 0; i < specs.length; ++i) { | |
var gutterClass = __specs[i] | |
var gElt = gutters.appendChild(elt('div', null, 'CodeMirror-gutter ' + gutterClass)) | |
if (gutterClass == 'CodeMirror-linenumbers') { | |
cm.display.lineGutter = gElt | |
gElt.style.width = (cm.display.lineNumWidth || 1) + 'px' | |
} | |
} | |
gutters.style.display = i ? '' : 'none' | |
updateGutterSpace(cm) | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment