I hereby claim:
- I am forrest-akin on github.
- I am forrest27 (https://keybase.io/forrest27) on keybase.
- I have a public key ASBkJ4UALmieCf5_bSiBoZqwBLZP0FEQsCQ4ojtB1qScbAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
const asyncMeaningOfLife = () => | |
Promise.resolve({ meaningOfLife: 42 }) | |
const updateResult = result => update => | |
Object.assign(result, update, { processing: false }) | |
function syncFun(afterUpdate) { | |
const result = { processing: true } | |
asyncMeaningOfLife() |
const findTheDifference = | |
( s , t ) => | |
String.fromCharCode( | |
foldMap( Sum , toCharCode , t ) | |
- foldMap( Sum , toCharCode , s ) ) | |
const toCharCode = char => char.charCodeAt() | |
const foldMap = | |
( M , f , xs ) => { |
const largestNumber = | |
xs => | |
headIsZero( | |
mapInPlace( toString , xs ) | |
.sort( byBestOrderForLargestNumber ) ) | |
? '0' | |
: xs.join( '' ) | |
const byBestOrderForLargestNumber = | |
( x , y ) => x + y < y + x || -1 |
const findPoisonedDuration = | |
( timeSeries , duration ) => | |
timeSeries.reduce( sumByCappedDelta( duration ) , 0 ) | |
const sumByCappedDelta = | |
( max , t1 = -max ) => ( sum , t2 ) => | |
( dt = t2 - t1 | |
, t1 = t2 | |
, sum + Math.min( dt , max ) ) |
const firstMissingPositive = | |
xs => { | |
for ( const x of xs ) | |
indexByValue( x , xs ) | |
let ndx = 0 | |
while ( xs[ ndx ] === ++ndx ) {} | |
return ndx | |
} | |
const indexByValue = |
class RecentCounter { ping = ping( [] , 0 ) } | |
const ping = ( pings , ndx ) => t => { | |
const min = t - 3000 | |
while ( pings[ ndx ] < min ) ndx++ | |
return pings.push( t ) - ndx | |
} |
function search ( nums , target ) { | |
for ( let low = 0 , high = nums.length - 1 , ndx | |
; low <= high | |
; nums[ ndx ] < target ? low = ndx + 1 : high = ndx - 1 | |
) if ( ndx = Math.floor( ( high - low ) / 2 ) + low | |
, nums[ ndx ] === target | |
) return ndx | |
return -1 | |
} |
function serialize ( root ) { | |
const queue = root ? [ root ] : [] | |
const nodes = [] | |
while ( queue.length ) { | |
nodes.push( node = queue.shift() ) | |
if ( node ) { | |
queue.push( node.left ) | |
queue.push( node.right ) |
I hereby claim:
To claim this, I am signing this object: