Skip to content

Instantly share code, notes, and snippets.

View runandrerun's full-sized avatar
🏠
Working from home

Andre Santiago runandrerun

🏠
Working from home
View GitHub Profile
const closestEnemy = (arr) => {
let player = [];
let enemy = [];
let distance = 0;
let rowLength = arr[0].length;
let board = arr.length;
for (let i = 0; i < board; i++) {
let row = arr[i].split("");
const closestEnemy = (arr) => {
let player = [];
let enemy = [];
let distance = 0;
let rowLength = arr[0].length;
let board = arr.length;
// iterate over the length of the board stored in arrWidth
for (let i = 0; i < board; i++) {
@runandrerun
runandrerun / spotUniqueCharSet.js
Created February 6, 2020 00:50
spotUniqueCharSet
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
@runandrerun
runandrerun / andreSantiagoResume.md
Last active November 11, 2019 21:35
Andre Santiago's Resume

Andre Santiago

Software Engineer

Mobile: 718-666-5306 | Email: the.asantiagojr@gmail.com LinkedIn | Portfolio | Blog

Experience

=============

Software Engineer

Area 23 | February 2019 – Present

  • Maintain and build: Websites, Animated Banners, E-Mail Client/Cross-Browser Compatible E-Mail Campaigns/Templates, Internal Components, and Mobile Apps
combinationLock = (initialState, code) => {
// declare a variable to account for total turns
let totalTurns = 0;
// iterate over the initialState array
// this what the lock looks like when it's first handed to you
initialState.forEach((i, index) => {
// i is the value
@runandrerun
runandrerun / combinationLock.js
Created November 13, 2018 17:11
Combination Lock Problem Set
combinationLock = (initialState, code) => {
let totalTurns = 0;
initialState.forEach((i, index) => {
let turns = Math.abs(i - code[index]);
if (turns <= 5) {
return (totalTurns += turns);
} else {
const newTurns = 10 - turns;
return (totalTurns += newTurns);
}
// 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,
function fibonacci(num){
var a = 1, b = 0, temp;
while (num >= 0){
temp = a;
a = a + b;
b = temp;
num--;
}
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;
const characterMatch = (stringA, stringB) => {
// basic optimization - store the lengths
const aLength = stringA.length;
const bLength = stringB.length;
// brute force: double for loops
// loop over the first argument (stringA)
for (let i = 0; i < aLength; i++) {
// for every index in stringA, loop over stringB
for (let k = 0; k < bLength; k++) {