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
// assume that coins is an array of positive integers | |
// assume that amount is non-negative | |
function minCoinChange(coins, amount) { | |
// create an array to hold the minimum number of coins to make each amount | |
// amount + 1 so that you will have indices from 0 to amount in the array | |
const minCoins = new Array(amount + 1).fill(Infinity); | |
// there are 0 ways to make amount 0 with positive coin values | |
minCoins[0] = 0; | |
// look at one coin at a time |
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
import multiprocessing | |
from django.core.management import BaseCommand | |
def multiprocess_func(view_func): | |
""" Decoratior which closes database connection before running wrapped function. | |
Also unpacks args for multiprocessing module. """ | |
def _decorator(args): | |
connection.close() |
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
int main() | |
{ | |
std::string input = "abc,def,ghi"; | |
std::istringstream ss(input); | |
std::string token; | |
vector<string> playerInfoVector; | |
while(std::getline(ss, token, ',')) { | |
playerInfoVector.push_back(token); | |
std::cout << token << '\n'; |