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 flatten = <T>(arr: T[][]): T[] => ([] as T[]).concat(...arr); | |
test("flatten", () => { | |
expect(flatten([[1], [2], [3, 4]])).toEqual([1, 2, 3, 4]); | |
}); |
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 node:10.14 | |
RUN mkdir /app | |
WORKDIR /app | |
RUN npm install [email protected] | |
COPY ./index.js . | |
CMD node ./index.js |
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
class CircularQueue { | |
constructor(size) { | |
this.size = size; | |
this.storage = Array.from(new Array(size)); | |
Object.seal(this.storage); | |
this.head = -1; | |
this.tail = -1; | |
} | |
queue(value) { |
OlderNewer