It seemed like a new question β I don't think the interviewer had interviewed with this one much before π , he wasn't very familiar with it either. Communication took quite a while, and sometimes the shadow and the interviewer disagreed with each other π
Part 1 gave a main() and a function header β you just had to implement the function. The interviewer initially said the output was an integer, but it was actually a string, and there was a format to it that you could only see by running the test β the problem statement didn't mention it either. The interviewer was pretty nice about it, said integer is good enough, and let me pass.
Part 2 added one more input, and also gave an output format, but the code editor was completely blank β a totally blank whiteboard, and I was completely lost π . The interviewer said feel free to copy anything from part 1, and also told me to feel free to define the input however I wanted, to make the problem easier. I thought, isn't that nonsense β if I define it myself, the code still has to run, HackerRank still has to compile it. When I did part 2, I copied over the main from part 1, and the open-file-path code in there threw an error immediately π , and then I was completely lost, and time ran out fast...
Anyways, let me go over the actual problem.
Part 1's input looked something like this (I don't remember if the start and end were always exactly one month apart, but in the example input the same bank account had rows across different years):
Bank Name,Account Name,Start Date,End Date,Balance
HSBC,123456,2021-12-01,2021-12-31,150
HSBC,123456,2019-05-1,2019-05-31,200
BA,566376374,2021-12-01,2021-12-31,300
Write a function whose parameters are bank name and account name, and output the latest balance.
Part 2 gave one more CSV-format input β I don't remember the exact fields, but it was roughly similar to part 1's. The output needed to be tallied by month. For example, if you're tallying for December 2021, you compare the two input tables, and if the same bank account's balance for that month matches between the two tables, it counts as a match.
The output looked roughly like this:
Bank Name,Account Name,End Date,Balance,Match
HSBC,123456,,2021-12-31,150,Match
BA,566376374,2021-12-31,300,Not Match
I didn't get to see part 3 before it ended.
Discussion
Loading commentsβ¦