Skip to content

Instantly share code, notes, and snippets.

Prompt

Given a target sum and an array of positive integers, return true if any combination of numbers in the array can add to the target. Each number in the array may only be used once. Return false if the numbers cannot be used to add to the target sum.

Examples

subsetSum(2, [1,10,5,3]); // false
subsetSum(10, [1,10,5,3]); // true
subsetSum(9, [1,10,5,3]); // true
@cfayolle
cfayolle / rainwaterCollector.md
Created July 10, 2018 18:39
Rain water Collector

Slides


Prompt

You're an industrious programmer that lives off the grid. The local well that you use to fetch water has gone dry, so you've decided to collect rain water to filter; however, your collection device isn't flat.

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water your collection device is able to trap after raining.

@cfayolle
cfayolle / ClockMinuteAdder.md
Created June 26, 2018 22:40
ClockMinuteAdder

class: center middle

Clock Minute Adder


Interviewer Prompt

Given:

  • a time in string format HH:MM
  • a number of minutes
@cfayolle
cfayolle / ClockMinuteAdder.md
Created June 25, 2018 20:58
Clock Minute Adder

class: center middle

Clock Minute Adder


Interviewer Prompt

Given:

  • a time in string format HH:MM
  • a number of minutes

class: center, middle

Intersection


class: center, middle

Prompt

@cfayolle
cfayolle / DictionaryWordFinder.md
Last active June 11, 2018 12:24
Dictionary Word Finder

class: center middle

Dictionary Word Finder

<style> .remark-code { white-space: pre-wrap; } </style>
@cfayolle
cfayolle / play-solution.js
Created May 6, 2018 20:55
play-solution.js
let first = true //Global variable
render(){
if (first){
first = false
socket.on('beat', count => {
this.playDrums()
})
}
@cfayolle
cfayolle / play-wrong.js
Created May 6, 2018 20:37
initial play
render(){
socket.on('beat', count => {
this.playDrums() //Play selected drum sounds on every beat from the pulse emitting from the server
})
return (
<div>
<MIDISounds ref={(ref) => (this.midiSounds = ref)} appElementName="app"
drums={[70, 80, 100, 175, 75, 65, 62, 52, 5, 10, 20, 45, 1, 15, 35, 55]} /> //Library used to play midi drum sounds
</div>
)