Palantir Phone Screen | Software Engineering Intern | London
Anonymous User
1320

Hi,
The following question was asked of me in a Palantir interview for the role of SWE Intern in London.

Problem and Question:

We have given shares of companies at a specific point in time (e.g., Apple, Tesla, and Palantir for 5/1, 5/5, and 5/8).

Q: How many shares do we have on each individual day?

On the first day, it is the sum of all companies. On the second day, we purchased 100 PLTR, bringing the total to 200 PLTR, and then we bought 50 AAPL, bringing the total to 50 AAPL, since we had none on the first day. We did not buy or sell any TSLA, so we take the value from 5/1 and add it. Thus, we have 450 in total on day 2, and so on.

Python
"""
-----    5/1     5/5      5/8
PLTR     100     200
AAPL              50      100
TSLA     200              100
-----   -----   ------   -----
Total    300     450      400
"""

stocks = [[("5/1", 100), ("5/5", 200)], #PLTR
          [("5/5",  50), ("5/8", 100)], #APPL
          [("5/1", 200), ("5/8", 100)]  #TSLA
          ]))
Output:
[("5/1", 300), ("5/5", 450), ("5/8", 400)]
Interview Outcome:

I was unable to solve the problem and was rejected.

I would appreciate any possible approaches to solving this, as I am interested in how it can be addressed most effectively. My initial intuition was to use a HashMap. Thank you!

Comments (3)