Unicorn Startup | OA 2019
Anonymous User
372
  1. Given a String of words seperated by spaces and a number K, return the original String broken up into lines, such that no line has more than K characters and each line contains the maximum number of words that can fit.

Example Input:

"His dog chases her cat", 15 

Output:

His dog chases
her cat
  1. You will write a program to ingest a user's current invesments, their historical activity, and assess which of their investments have had the best returns. You are given an input file that is divided into two sections: Current holdings and trades

Example input file:

3
4 AAPL valued $100 each
10 SPY valued $200 each
20 BND valued $150 each
5
bought 10 AAPL at $300
sold 6 AAPL at $250
bought 5 SPY at $50
bought 5 SPY at $75
bought 20 BND at $145

Example output:

Total $275
SPY $1375
BND $100
AAPL -$1100
  • Holders per share plus total sells per share minus total buys per share will equal 0
  • If a symbol shows up in either the holding or trade, it should show up in the output.
  • A symbol may be excluded from the holdings if the total shares bought equals the total shares sold.
  • Output should be sorted by reverse order of the gain.
Comments (1)