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
/** | |
* Heavy handed approach adds text wrapping to all cells. | |
* Doesn't seem to break anything for other field types…. | |
* Haven't thoroughly tested. | |
* New: | |
<cellXfs count="2"> | |
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"> | |
<alignment wrapText="true"/> | |
</xf> | |
<xf numFmtId="3" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"> |
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
#!/bin/sh -e | |
# Just the base command required to run ffmpeg docker image | |
# Probably need to append additional arguments such as | |
# -i input_file.ext | |
# -parm1 arg | |
# -parm2 arg | |
# output_filename.ext | |
docker run \ |
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
class PriorityQueue { | |
constructor() { | |
this.heap = [null] | |
} | |
insert(value, priority) { | |
const newNode = new PriorityQueueNode(value, priority); | |
this.heap.push(newNode); | |
let currentNodeIdx = this.heap.length - 1; | |
let currentNodeParentIdx = Math.floor(currentNodeIdx / 2); |
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
class Node { | |
constructor (value) { | |
this.value = value; | |
this.left = null; | |
this.right = null; | |
} | |
} | |
class BinarySearchTree { | |
constructor () { |
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 repeatedString(s, n) { | |
if (n < 1) return 0; | |
let initialMatches = s.match(/a/gm); | |
// Hackerrank is not down with nullish coalesce or even optional chaining AT ALL | |
// Otherwise, you could simply say if (!initialMatches?.length) | |
if (!initialMatches || !initialMatches.length) return 0; | |
if (n < initialMatches.length) { | |
return n; |
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 kth (m, k) { | |
return m.reduce((curr, next) => curr.concat(next)) | |
.sort((x, y) => x >= y? 1: -1) | |
[k]; | |
} | |
// e.g., [[1, 5, 9], [10, 11, 13], [12, 13, 15]], 7 | |
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
[ | |
{ "node": 1, "link": 4 }, | |
{ "node": 4, "link": 5 }, | |
{ "node": 5, "link": null }, | |
{ "node": 1, "link": 3 }, | |
{ "node": 3, "link": 4 }, | |
{ "node": 4, "link": null }, | |
{ "node": 2, "link": 6 }, | |
{ "node": 6, "link": null } | |
] |
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
class LFUCache { | |
constructor(capacity) { | |
this.capacity = capacity; | |
this.lru = []; | |
this.cache = Object.create(null, {}); | |
} | |
get(key) { | |
if (!this.cache[key]) return -1; | |
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 isAsc (list = []) { | |
return list.reduce((curr, acc, index, arr) => { | |
if (curr === false) return false; | |
if (acc > curr) { | |
if (index === arr.length - 1) { | |
return true; | |
} else { | |
return acc; | |
} |
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
class TrieNode { | |
constructor (word) { | |
this.word = word; | |
this.nodes = {}; | |
this.end = false; | |
} | |
} | |
export default class Trie { | |
constructor (word) { |
NewerOlder