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 nextPermutation(previousPermutations: string[][]): string[] { | |
const nextPermutationsLength = previousPermutations.length; | |
let nextPermutations = []; | |
for (let i = 0; i < nextPermutationsLength; i++) { | |
// each of the previous permutations becomes our "inner" permutations (array) | |
const innerPermutations = previousPermutations[i]; | |
// calculate how many outer permutations we need based on where we are in the loop | |
const outerPermutationsLength = nextPermutationsLength - 1 - i; | |
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 generateParenthesis(n: number): string[] { | |
if (n === 1) { return ["()"]; } | |
let result = new Set<string>(); | |
let previousCombos = generateParenthesis(n-1); | |
for (let i in previousCombos) { | |
let combo = previousCombos[i]; | |
// wrap all previous entries in parens and put those in the set |
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 earliestAcq(logs: number[][], n: number): number { | |
logs.sort((a:number[], b:number[]) => { | |
return (a[0] - b[0]); | |
}); | |
let mapOfSets = new Map(); | |
// put every friend ID into its own individual set - O(n) | |
for (let i = 0; i < n; i++) { |
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
<html> | |
<div> | |
<p>This is a test document. | |
<a href="https://google.com">Google link</a> | |
<a href="/dp/B0077QSLXI?creativeASIN=B0077QSLXI&tag=eltakosp-21&cv_ct_pg=article-page&cv_ct_id=amzn1.osa.653ce0b4-6ed1-42c8-9daf-6654894dfe55.A1PA6795UKMFR9.de_DE&ascsubtag=amzn1.osa.653ce0b4-6ed1-42c8-9daf-6654894dfe55.A1PA6795UKMFR9.de_DE&linkCode=oaa&cv_ct_wn=article-page">de link</a> | |
<a href="https://amzn.to/2VWwm1f">Shortened link</a> | |
<a href="http://www.amazon.com/gp/product/B00HQ4W3OE/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B00HQ4W3OE&linkCode=as2&tag=diy07a-20&linkId=OEVMCK2DEF22CXZY">Long link</a> | |
<a href="http://www.amazon.com/gp/product/B00HQ4W3OE/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B00HQ4W3OE&linkCode=as2&tag=diy07a-20&linkId=OEVMCK2DEF22CXZY">Duplicate link</a> | |
<a href="https://www.amazon.com/gp/product/B01N1GI969/ref=as_li_ss_tl?ie=UTF8&psc=1&smid=A2UZVIGPN3KFSI&linkCode=ll1&tag=diy07a-20&linkId=9844cef6c9b125a0133b548290c9fd2 |
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
let allPosts = [ {id: 123, name: "test post 1"}, | |
{id: 456, name: "test post 2"} | |
]; | |
let allReplies = [ {id: 1, replyTo: 123, name: 'reply 1', read: false}, | |
{id: 2, replyTo: 123, name: 'reply 2', read: false}, | |
{id: 3, replyTo: 456, name: 'reply 3', read: false} | |
]; | |
// simulate a server response with 1s wait time | |
const getRepliesToPost = async (id: number) => { |
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
// Closure example, sort of a companion to my JS example: | |
// https://repl.it/@MandiGrant/JSClosureExample | |
// combineNames is a function that returns a function. | |
var combineNames = (firstName) { | |
return (lastName) => firstName + ' ' + lastName; | |
}; | |
/* If you call it like this, |
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
// Closure example, sort of a companion to my JS example: | |
// https://repl.it/@MandiGrant/JSClosureExample | |
// combineNames is a function that returns a function. | |
var combineNames = (firstName) { | |
return (lastName) => firstName + ' ' + lastName; | |
}; | |
void main() { | |
// Call it with a first name and then call *that* function with a last 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
.amazin-product-box { | |
background-color:#ffffff; | |
color:#181c1a; | |
} | |
.amazin-product-box h3 { | |
margin:16px 0px; | |
} | |
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
.amazin-featured-box { | |
border:none; | |
} | |
.amazin-featured-box-text { | |
padding:26px !important; | |
} | |
.amazin-featured-box-text, .amazin-featured-box-text p { | |
margin:0px !important; | |
font-family:"Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif !important; |
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
/* Default styles for the Amazin' Featured Box */ | |
.amazin-featured-box { | |
border:1px solid grey; | |
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | |
padding:0px; | |
width:80%; | |
margin:30px auto !important; | |
} | |
.amazin-featured-box p, .amazin-featured-box h2, .amazin-featured-box h3 { |
NewerOlder