https://gist.github.com/johntran - > bigO2018Nov20.md
https://gist.github.com/johntran - > big2019Feb19.md
Given an array of positive and negative numbers, find if there is a subarray (of size at-least one) with 0 sum and return the subarray.
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
export default function useToggle(initial = false) { | |
const [open, setToggle] = useState(initial); | |
return { | |
open, | |
set: setToggle, | |
setOpen: () => setToggle(true), | |
setClose: () => setToggle(false), | |
reset: () => setToggle(initial), | |
toggle: () => setToggle(prev => !prev), | |
}; |
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
export default function foo() { | |
return bar(); | |
} | |
function bar() { | |
return baz(); | |
} | |
function baz() { | |
return 42; |
OlderNewer