ID Generator Interview Problem (C++)

C++ Interview with a Snowflake engineer

Interview Summary

Problem type
ID generator
Interview question

  1. Design a system to generate unique IDs for a healthcheck system.

Interview Feedback

Feedback about Ghost Koala (the interviewee)
Advance this person to the next round?
Yes
How were their technical skills?
3/4
How was their problem solving ability?
4/4
What about their communication ability?
4/4

Overall you did great. My one piece of feedback for problem solving was not to frame it as finding the "bad solution" and "good solution", but just discuss the space of possible solutions and identify tradeoffs.

Feedback about Winged Avenger (the interviewer)
Would you want to work with this person?
Yes
How excited would you be to work with them?
4/4
How good were the questions?
4/4
How helpful was your interviewer in guiding you to the solution(s)?
4/4

1/4

Interview Transcript

Ghost Koala: Hello.

Winged Avenger: Hello, can you hear me?

Ghost Koala: Yes, I can. Can you hear me?

Winged Avenger: Yes.

Ghost Koala: Awesome. How are you doing?

Winged Avenger: Good, how about you?

Ghost Koala: I'm doing pretty good. Thanks for asking.

Winged Avenger: Awesome. Cool. Well, let's go and get started then.

Ghost Koala: Sure, absolutely. So yeah, just briefly, my background. I graduated back in 2011. My education is in mechanical engineering. And, you know, my career so far has been purely in manufacturing have kind of worked my way up to product management. And, but the whole time, I've been doing like a ton of kind of self-taught programming and coding, to the point where I'm now at a point where I think I have enough skills and know how to transition my career into software engineering. And, and that's what I'm trying to do.

Winged Avenger: Gotcha. Yeah, that makes sense.

Ghost Koala: So what I hope to get out of this is just, you know, as much as possible, try to emulate what that interview is going to be like, just to kind of see how well prepared I am or I guess really just to kind of practice and prepare myself for tomorrow.

Winged Avenger: So, is there a particular area you're like, you know, full stack, front end, machine learning?

Ghost Koala: Yeah. So I guess the jobs I'm interviewing for are pretty generalist or backend focused.

Winged Avenger: Okay.

Ghost Koala: And really, I want to focus on making sure I walk through the problem systematically.

Winged Avenger: Sounds good.

Ghost Koala: Volunteering is crucial in interviews to frame responses.

Winged Avenger: Absolutely, it sounds good.

Problem Discussion

So, the problem I want to deal with today is having some sort of unique identifier for services to track and monitor them. We want to implement a Service ID generator, where the unique ID will be given to each service at start-up that no other service currently running is using.

Ghost Koala: Let's see. Is there any indication of how many processes could be running?

Winged Avenger: Let's assume 32-bit integers are sufficient.

Ghost Koala: Okay. Cool. So what about concurrency? Do I have to worry about multiple processes coming in at the same time either requesting or looking to release an existing ID?

Winged Avenger: Yes, for now, let's assume you can handle concurrency with a global locker.

Getting into Implementation

Ghost Koala: So I want to code this up as a class called IDGenerator. I need to handle methods like getID to retrieve an ID and releaseID to release back an ID.

Feedback Summary

Rotational feedback focused heavily on efficient system design balances

Videos and Further Resources