Skip to content

Instantly share code, notes, and snippets.

@vladkotu
Created May 26, 2017 16:35
Show Gist options
  • Save vladkotu/9b63ab16f23dd521e100e52dcfad8451 to your computer and use it in GitHub Desktop.
Save vladkotu/9b63ab16f23dd521e100e52dcfad8451 to your computer and use it in GitHub Desktop.

tasks from interview

transactions

Given intup data (transactions)

const transactions = [
    ['usd', 'buy', 10000],
    ['usd', 'sell', 5000],
    ['gbp', 'buy', 9000],
    ['eur', 'sell', 7000],
    ['uah', 'buy', 10000],
    ['usd', 'sell', 25000],
];

Implement function thats return

const result = {
    usd: [10000, 30000],
    gbp: [9000, 0],
    eur: [0, 7000],
    uah: [10000, 0],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment