The OA is split into three parts: Algorithm, Spring Boot Backend, and React Frontend.
The Algorithm part tests a sliding window (I forget whether there was AI assist, I didn't use it). The Spring Boot part is debugging how configuration/profiles get loaded (AI assist). The React part is debugging state management and the ajax calls to the backend (AI assist).
Details below.
Algorithm. The gist of the problem: you are like a teacher leading a group of talents to a competition. Each talent is good at a certain subject, and different competitions need different numbers of unique subjects. For each starting position, going left to right through the talents, you return the smallest subarray length that satisfies the competition's unique-subjects count.
Two inputs: an integer array (talents), where each element's value is the subject that talent is good at, and an integer, the required unique subjects count for the competition.
Example:
Input:
[1, 2, 3, 4, 3, 5]
3
Output:
[3, 3, 4, 3, -1, -1]
The three 3s in the output are the lengths of [1, 2, 3], [2, 3, 4] and [4, 3, 5]. The 4 is the length of [3, 4, 3, 5]. The -1s mean that looking to the right you can no longer gather 3 unique subjects (note: I forget whether it should return 0 or -1). Sliding window plus a HashMap count (or an int array count) gives an O(n) solution.
Spring Boot Backend. It mainly tests Spring Boot configuration loading, profiles, and dependency injection. Be familiar with:
- how to use @Value, including default values
- the override mechanism of application.properties (note: it might also be in yml format)
- the syntax for specifying a profile (it's safest to know both the way you write it in main and the way you write it in a script)
The following is for reference only, please test it locally yourself:
public static void main(String[] args) {
new SpringApplicationBuilder(MyApplication.class)
.profiles("dev") // activate "dev"
.run(args);
}
java -jar app.jar --spring.profiles.active=dev
One thing to watch out for: the red text in the console log. The test cases pass, but there is actually red text in the console log, which is test case failures under the staging profile. One of the staging profile failures was because you need to implement throwing a specified exception if the user credential is missing. The other staging profile failure had to do with a default value being missing or not set correctly; I ran out of time and couldn't find the root cause...
React. A website user can add a movie to their watchList. The bug is that the user adds it, but when they go to the watchList the movie still isn't there. The project structure is roughly: on the movieDetail page you can add a movie to the user's watchList, the watchList page shows the movies that were added, and watchListController handles the request.
I never found the root cause of the bug in the end, so the following is for reference only:
- check the state of whether the movie is already in the user's watchList in movieDetail (inWathchList)
- check how watchListController figures out the userId (from a parameter or from the token)
- check the call path of fetching the watchList (and all the inputs, including the token)
One thing to watch out for: to reproduce the bug you need to log in, but the user credential can't be copied and pasted from the problem statement into the UX component... I lost a lot of time typing in the user credential, because you have to log in over and over while testing. I'd suggest typing it into the coding interface and commenting it out (you can copy/paste inside the coding interface, but I'm not sure whether you can copy/paste from the coding interface into the UX component, I never got the chance to try, so this is only a possible way). But be sure to remove it when you finally submit the solution, so you don't get a red flag (leaving the user credential in your code).
The AI Assist part. You can ask it syntax questions. You can ask the AI to list all the ajax calls under a file, and to locate which file a given operation is in, that kind of thing. The AI seems to be specifically restricted on questions about the root cause of the bug, so when you ask about a specific React state or a specific ajax call path it tells you to find it yourself. So when the AI starts refusing to answer, you may well be on the right path.
Hope these details and takeaways help everyone! Good luck to everyone who is on the interview road right now.
Discussion
Loading comments…