Skip to content

Instantly share code, notes, and snippets.

View mkstix6's full-sized avatar

Mark Stickling mkstix6

View GitHub Profile
@indiesquidge
indiesquidge / promise-dot-all.js
Last active January 20, 2024 15:03
Recreating Promise.all with async/await
/*
Let us re-create `Promise.all`
`Promise.all` method returns a promise that resolves when all of the promises in the iterable argument have resolved,
or rejects with the reason of the first passed promise that rejects.
Read more about `Promise.all` on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
A basic example would be something like this:
@les-peters
les-peters / 2022-04-17.py
Created April 23, 2022 16:53
Largest Subarray Sum
question = """
Given an unsorted array of integers and a number n, find the subarray of length n that has the largest sum.
Example:
$ largestSubarraySum([3,1,4,1,5,9,2,6], 3)
$ [9, 2, 6]