Google | New Grad | Tokyo | Online | Reject

Got contacted by recruiter via email, asking to fill a basic form with my availability to start working (if I have passed the process) with a range of dates and basic explanations about further steps. Also need to choose an appointment for an online coding test in case I passed the screening process.

A week later the recruiter reached me again to confirm I have passed the screening process and can continue with the coding challenge. The challenge consisted in two different questions and two hours to complete them both:

First question:

Was an optimization problem very similar to the knapsack one (I guess is this one), but with some variations:

I was given an input file with several testcases (about 100 test cases):

  • Each test case included some ramen flavors, some toppings for the ramen and an objective value (the money we are willing to pay for a ramen dish).
  • Each flavor and topping came along with an associated price, and we could choose at most one ramen flavor and either zero, one or two toppings in order to get as much closer as possible to the objective price.

Also there was a restriction such that, in case that the distance to the objective price was the same, e.g. we have 1000 as objective price and we arrive to two different solutions (950 and 1050), it would be better to choose the one with the smaller cost.

I tried following some kind of dynammic programming approach to solve this one but in the end didn't make it for more than 10 test cases...

Second question:

This seemed easier to me. I was asked to compute the minimum diameter of a graph. The diameter within a graph for a node x is the minimum distance to another node y which is the farthest node from x. Knowing this, all we had to do is to compute this diameter for every node in the graph and retrieve the minimum of these diameters. For the computation of the diameters I used mostly DFS, an adjacency list with the edges and an auxiliar boolean set to keep track of the visited nodes at every step.

There was a particularity in this problem that I didn't used at all, but I'm cquite sure that it would have helped. The statement said that the graph had a tree shape, not sure if it will be helpful (for me it wasn't) but I'll leave it here.

For this second question I passed about 90 out of 100 test cases or something like that, so way more better than the first one.

Got contacted today with a reject, which in fact makes sense because of the first question.

Comments about the platform:

The platform consisted of a login screen and then the main screen with the statements of the problem, which were quite long, the input files at the end of each statement with examples and also the format for the required output files. There was another screen for the submissions of each statement (you needed to upload both the code and your output file) which automatically showed how many test cases you were passing after the submission.

There wasn't an integrated platform to write and execute your code like here in LeetCode or similars. This was a bit time consuming as you had to parse yourself the input file (which is quite time consuming at the very beginning) and also prepare the exporter for the output file (which I did just by printing and redirecting the output to a file).

Hope this helps to anyone who needs it, and do not hesitate to ask for any missing detail. Good luck with your interviews!!

Comments (8)