This file contains 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
var pokemon = { | |
firstname: 'Pika', | |
lastname: 'Chu ', | |
getPokeName: function() { | |
var fullname = this.firstname + ' ' + this.lastname; | |
return fullname; | |
} | |
}; |
This file contains 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
// Suppose we could access yesterday's stock prices as an array, where: | |
// The indices are the time in minutes past trade opening time, which was 9:30am local time. | |
// The values are the price in dollars of Apple stock at that time. | |
// So if the stock cost $500 at 10:30am, stockPricesYesterday[60] = 500;. | |
// Write an efficient function that takes stockPricesYesterday and returns the best profit | |
// I could have made from 1 purchase and 1 sale of 1 Apple stock yesterday. | |
This file contains 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 waysToReturnChange(denominations, numOfCoins, amount) { | |
if(amount === 0) return 1; // Perfect! | |
if(amount < 0) return 0; // No solution exists for negative amount | |
if(numOfCoins < 0 && amount > 0) return 0; // We don't have coins left! | |
return; | |
} |
This file contains 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 waysToReturnChange(denominations, numOfCoins, amount) { | |
if(amount === 0) return 1; // Perfect! | |
if(amount < 0) return 0; // No solution exists for negative amount | |
if(numOfCoins < 0 && amount > 0) return 0; // We don't have coins left! | |
console.log('checking ways to make ' + amount + ' with ' + denominations.slice(numOfCoins)); |
This file contains 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 waysToReturnMemoize(amount, denominations) { | |
// intialize an array of zeros with indices up to amount | |
var waysOfDoingNcents = []; | |
for (var i = 0; i <= amount; i++) { | |
waysOfDoingNcents[i] = 0; | |
} | |
// there is 1 way to renturn 0 cents | |
waysOfDoingNcents[0] = 1; | |
for (var j = 0; j < denominations.length; j++) { |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script> | |
</head> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omer's Workshop</title> | |
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<p> | |
Counter: <span id="value">0</span> times |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omer's Workshop</title> | |
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<p> | |
Counter: <span id="value">0</span> times |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omer's Workshop</title> | |
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<p> | |
Counter: <span id="value">0</span> times |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<h1>Cookies!</h1> | |
<button>Show cookies</button> | |
</body> | |
</html> |