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
const input = document.children[0].textContent.split('\n').filter(x => x.length).map(movement => movement.split(' ')) | |
input.reduce((acc, currentTuple, index, array) => { | |
switch(currentTuple[0]) { | |
case "forward": acc[0] = acc[0] + parseInt(currentTuple[1]); break; | |
case "up" : acc[1] = acc[1] + parseInt(currentTuple[1]); break; | |
case "down": acc[1] = acc[1] - parseInt(currentTuple[1]); break; | |
} | |
return acc; | |
}, [0, 0]); |
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
FROM php:7.4-fpm-alpine | |
WORKDIR /var/www/app | |
RUN apk add bash | |
# intl | |
RUN apk add --quiet zlib-dev icu-dev g++ | |
RUN docker-php-ext-install intl && docker-php-ext-enable intl |