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 fs from "fs"; | |
const lines = fs.readFileSync("./data.csv", "utf8").split("\n"); | |
let idx = 0; | |
const asRecords: Array<Record<string, any>> = []; | |
while (lines.length) { | |
const line = lines.pop(); | |
const [colId, colProp, colVal] = line!.split(","); |
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
function isSubsequence(s: string, t: string): boolean { | |
let aIdx = 0; | |
let bIdx = 0; | |
while ((aIdx < s.length) && (bIdx < t.length)) { | |
const aChar = s.charAt(aIdx); | |
const bChar = t.charAt(bIdx); | |
if (aChar === bChar) { | |
aIdx++; | |
} |
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
// console.log can be used to print information to the screen | |
console.log("Hello, World"); // prints "Hello, World" | |
// Create an object `foodItem` to hold some information | |
var foodItem = { | |
fat: 25, | |
carbs: 82 | |
} | |
// fat and carbs are now stored insode of foodItem |