Skip to content

Instantly share code, notes, and snippets.

@achacttn
achacttn / js
Last active September 28, 2020 04:05
Longest subarray with sum <= k
const longestSubarrayLength = (arr, k) => {
let longestLength = 0;
for (let i = 0; i < arr.length; i++) {
let currentSum = 0;
let currentCount = 0;
let currentSlice = arr.slice(i);
console.log('currentslice: ', currentSlice);
// for current slice, add values as long as sum is <= k
for (let j = 0; j < currentSlice.length; j++) {
if (currentSum + currentSlice[j] <= k) {
@achacttn
achacttn / redux-archeology-notes.md
Created July 29, 2018 05:03 — forked from markerikson/redux-archeology-notes.md
Redux Archeology and Design Notes

Design Goals

reduxjs/redux#8 (comment)

The main goal of this library is to prove that Flux can be implemented in a way compatible with full hot reloading (and explore how this can be done). You can run the example code with npm start, change action creators or stores, and the new logic will kick in before you refresh.