Goldman Coderpad Interview experience

goldman sachs logo
goldman sachs
June 2, 20251 reads

Summary

I had a Coderpad interview at Goldman Sachs involving two coding problems. I struggled with the first problem and encountered technical difficulties during the second, which prevented me from completing it.

Full Experience

I was asked two questions during my Goldman Coderpad interview. For Q1, I discussed it a lot but was unable to come up with a solution. For Q2, I moved to it when only 10 minutes were left. A power cut occurred at my end, and when I re-joined, the interviewer asked me to return to Q1.

Interview Questions (2)

Q1
Hermione's Cheat Sheet Encoding
Data Structures & Algorithms

Hermione is preparing a cheat-sheet for her final exam in Potions class. To create a potion, one must combine ingredients in a specific order, any of which may be repeated.

As an example, consider the following potion which uses 4 distinct ingredients (A,B,C,D) in 11 steps: A, B, A, B, C, A, B, A, B, C, D

Hermione realizes she can save tremendous space on her cheat-sheet by introducing a special instruction, '*', which means "repeat from the beginning".

Using these optimizations, Hermione is able to encode the potion above using only 6 characters: A,B,* ,C,*,D

Your job is to write a function that takes as input an un-encoded potion and returns the minimum number of characters required to encode the potion on Hermione's Cheat Sheet.

Q2
Rock Collector Optimal Path
Data Structures & Algorithms

You are an avid rock collector who lives in southern California. Some rare and desirable rocks just became available in New York, so you are planning a cross-country road trip. There are several other rare rocks that you could pick up along the way. You have been given a grid filled with numbers, representing the number of rare rocks available in various cities across the country. Your objective is to find the optimal path from So_Cal to New_York that would allow you to accumulate the most rocks along the way.
Note: You can only travel either north (up) or east (right).

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!