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
| function maxProfitWithKTransactions(prices, k) { | |
| let maxProfit = []; | |
| let boughtPrice = null; | |
| let buy = []; // total of buys | |
| let sell = []; // total of sells | |
| let profitableTrades = []; | |
| let transLimit = null // will be handled by .5 increments | |
| let holdStock = false; | |
| //EDGE CASES |
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
| <section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'> | |
| <h2>Gist-Powered</h2> | |
| <h1>Reveal.js</h1> | |
| <h2>Slideshow Presentations</h2> | |
| <br/> | |
| <h1 class='fragment grow'><a style='color:deepskyblue;' href='http://gist-reveal.it'>gist-reveal.it</a></h1> | |
| </section> | |
| <section data-background-transition='zoom' data-transition='linear' id='try-it'> | |
| <h2>Try it out!</h2> | |
| <p>Create your own deck by forking a copy of <a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>this github gist</a>: <br /><a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>https://gist.github.com/ryanj/af84d40e58c5c2a908dd</a></p> |
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
| Beer = [ | |
| {type: 'wheat', area: {city: 'Berlin', country: 'Germany'}, hop: 3 }, | |
| {type: 'pilsner', area: {city: 'venice', country: 'Italy'}, hop: 1 }, | |
| {type: 'IPA', area: {city: 'Berlin', country: 'Germany'}, hop: 5 } | |
| ] |
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
| /* | |
| Write a function modifyObject that takes 3 arguments and returns a new object. | |
| Arguments: | |
| 1) An object that we would like to add to | |
| 2) An object that dictates what needs to be added | |
| 3) A boolean value that specifies whether the values of object1 should be modified or not. | |
| If true, the values of object1 should be overwritten by the values of object2 | |
| If false, the values of object1 cannot be modified. |