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 dictionaryMatch = (stringA, stringB) => { | |
// create an empty dictionary to store your string | |
const dictionary = {}; | |
// split stringA by character and iterate over it | |
// create a new key value pair in the dictionary | |
// for each unique character within the array | |
stringA.split('').forEach(character => { | |
dictionary[character] = character; |
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 fibonacci(num){ | |
var a = 1, b = 0, temp; | |
while (num >= 0){ | |
temp = a; | |
a = a + b; | |
b = temp; | |
num--; | |
} |
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
// this reducer takes in the initial state and the action called | |
bodegaReducer = (state = initialBodegaState, action) => { | |
// the below switch case decides what to do based on the action | |
switch(action.type) { | |
// since 'ENTER_BODEGA' is called | |
// insideBodega is toggled to be true | |
case 'ENTER_BODEGA': | |
return { | |
...state, | |
insideBodega: true, |
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 paragraph = "If you want to jumpstart the process of talking to us about this role, here’s a little challenge: write a program that outputs the largest unique set of characters that can be removed from this paragraph without letting its length drop below 50."; | |
const spotUniqueCharSet = (paragraph) => { | |
const dictionary = {}; | |
const sortedDictionary = {}; | |
let characterSet = []; | |
let sortable = []; | |
let paragraphLength = paragraph.length; | |
// map over paragraph to find unique appearance counts in the paragraph provided |
OlderNewer