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 cities = ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']; | |
const result = groupPermutations(cities); | |
console.log(result); | |
function groupPermutations(words) { | |
const map = words.reduce((acc, next) => { | |
sortedName = next.toLowerCase().split('').sort().join(''); | |
var list = acc[sortedName]; |
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
FROM openjdk:8 | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update | |
RUN apt-get -qq update | |
# Install node | |
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - | |
RUN apt-get install -y nodejs |
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
// Imagine we have an observable of key counts. Each message has a key and a count, like so | |
// { | |
// key: "SomeKey", | |
// count: 16 | |
// } | |
// We use buffer to convert this to an observable of arrays of messages | |
// Now we want to reduce each array, keeping only the latest count for each key | |
var messages = getKeyCountsObservablefromSomewhere() | |
.buffer(function () { return Rx.Observable.timer(50); }) |