This file contains hidden or 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
| #bash <(curl -sL https://gist.githubusercontent.com/mob-sakai/174a32b95572e7d8fdbf8e6f43a528f6/raw/hello.sh) | |
| #terminal | |
| brew install vim | |
| brew install zsh | |
| brew install hyper | |
| brew install bat | |
| brew install z | |
| #code |
This file contains hidden or 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
| //breadth first iterative | |
| const hasPath = (graph, src, dst) => { | |
| let queue = [src]; | |
| while(queue.length > 0) | |
| { | |
| let current = queue.shift() | |
| if(current === dst) | |
| { |
This file contains hidden or 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
| const assert = require('assert'); | |
| //i = item index | |
| //left child index = 2i +1 | |
| //right child index = 2i +2 | |
| const heapPush = (heap:Array<number>, value: number) => { | |
| heap.push(value) | |
| let index = heap.length-1; |
This file contains hidden or 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
| const assert = require("assert"); | |
| const nextPrime = (primes: Array<number>) : number => { | |
| if(primes.length == 0) | |
| { | |
| return 2; | |
| }else if(primes.length == 1) | |
| { | |
| return 3; | |
| } |
This file contains hidden or 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
| const assert = require('assert'); | |
| const fib = (n: number, memo?: Array<number>): number => { | |
| if (memo == null) { | |
| memo = Array(n); | |
| } | |
| if (memo[n] === undefined) { | |
| memo[n] = n == 0 || n == 1 | |
| ? 1 | |
| : fib(n - 1, memo) + fib(n - 2, memo); |
This file contains hidden or 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
| //Given an integer array | |
| //move all elements that are equal to 0 to the left while maintaining the order of other elements in the array. | |
| //[1,0,2,0,3] => [0,0,1,2,3]; | |
| /* | |
| [1,0,2,0,3] | |
| [0,1,2,0,3] |
This file contains hidden or 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
| var Mocha = require('mocha') | |
| var assert = require('assert') | |
| var mocha = new Mocha() | |
| // Bit of a hack, sorry! | |
| mocha.suite.emit('pre-require', this, 'solution', mocha) | |
| /* | |
| Given a sorted array of integers |
This file contains hidden or 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 getEndEnhancer() { | |
| if (!statusIcon) { | |
| return endEnhancer; | |
| } | |
| if (endEnhancer) { | |
| return ( | |
| <> | |
| {' '} | |
| {statusIcon} <Block spaceInline="space020" /> {endEnhancer}{' '} |
This file contains hidden or 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 * as React from 'react'; | |
| import { getColorCssFromTheme, getSpacingCssFromTheme, styled } from '../../utils/style'; | |
| import { Grid, Cell } from '..'; | |
| import { Stack } from '../../stack'; | |
| import { Block } from '../../block'; | |
| const DowNav = styled.div` | |
| ${getColorCssFromTheme('background-color', 'interfaceBrand020')} | |
| height: 72px; | |
| width:100%; |
NewerOlder