Goldman Sachs online assessment Goldman Sachs 20 minutes steady over share

844 Views
No Comment

Recently, I've been in an intensive OA bombing mode, scheduling several shows a day, almost non-stop. Yesterday just finished a round of Goldman Sachs online assessment(HackerRank platform), the overall difficulty is not exaggerated, 20 minutes to do a steady finish, just to review with you in detail, to give some reference to partners who are still preparing.

This time, the questions were mainly two Coding, although it is not the kind of super difficult DP/graph theory, but there are some details that are easy to fall into the pit. I'd like to share my thoughts and notes.

Problem 1: Minimize Machine Usage

Problem Statement.
You are given a set of machines, each with a certain number of usages. The goal is to bring all usage counts down to zero through a series of operations.

  • In one operation, you can select two machines and decrease each of their usage counts by one.
  • You need to determine the minimum number of operations required to make all machines reach zero.

Key Insights.
This problem can be efficiently solved with a greedy strategy:

  • In every step, pair the machine with the highest usage count with the machine that has the lowest usage count, and reduce both.
  • Repeating this ensures that the "heaviest load" is being balanced by the "lightest load," preventing unnecessary leftover usages.

Special Case Handling.

  • If a machine's usage count becomes very small, it can quickly be reduced to zero without wasting additional operations.

Implementation Details.

  • The data size is not very large, so simulation with priority queues is feasible.
  • A max heap can be used to always extract the machine with the largest usage count, and a min heap For the smallest one.
  • Each operation decreases both selected values, and the total count of operations is accumulated until all values reach zero.

Answer.
The final result is simply the sum of all operations performed.
This greedy pairing guarantees the minimum number of steps.

Problem 2: Pods and Costs Placement

Problem Statement.
You are given a collection of elements, where each element has two attributes.

  • pod
  • cost

The task is to arrange these elements in an array according to the following rules.

  1. Elements with a higher cost must be placed with higher priority.
  2. After placing high-cost elements, the lower-cost elements should be assigned to the remaining available positions.

Key Insights.
This is a greedy + data structure problem.

  • First, treat each element as a pair (pod, cost).
  • Sort all elements in descending order of cost.
  • Traverse the sorted list.
    • If the position of a high-cost element is available, it should be fixed there.
    • For lower-cost elements, if the intended position is already occupied, they must move to the next available free slot.

Optimization.
Naively scanning linearly for the next free position is inefficient. Instead.

  • Use a map or disjoint set union (DSU/union-find) to keep track of the "next available position."
  • This allows jumping directly to the nearest empty slot without checking one by one.

Implementation Strategy.

  1. Sort by cost (descending).
  2. Insert elements in order, fixing high-cost ones first.
  3. Maintain the next available slot pointer using DSU or a map for efficient placement of remaining elements.

Takeaway.
The problem combines greedy prioritization (cost ordering) with efficient data structure usage (map/DSU) to handle placement in logarithmic or near-constant time.

Goldman Sachs online assessment Overall Difficulty and Feelings

To be honest, this Goldman Sachs OA is quite friendly, unlike some OAs that love to test fancy probability questions or tricky DPs. the logic of the two questions here is relatively intuitive, and the difficulty lies mainly in the implementation details.

It took me about 20 minutes, mostly spent debugging boundary conditions. For example:

Problem 1 If the machine count is 0, the loop will be broken in a timely manner.

Problem 2 In this case, the space allocation, if not written tightly enough, may overwrite already placed high-cost elements.

It's easy to waste ten minutes debugging when you're not stepping on these kinds of details.

Tips for Preparing for Goldman Sachs OA

  1. brush up: Greedy, sorting, map/heap Such data structure type of questions should be reviewed with emphasis.
  2. pace: Goldman Sachs' OA time isn't exactly tight, but it can be dangerous if you get stuck on the details.
  3. on-the-spot exerciseTry to simulate the real environment, do the questions regularly, and familiarize yourself with the "stuck thinking" in advance.

Many students actually know how to do the questions, but tend to panic in the real world, for example:

Not sure when to decisively give up brute force.

When debugging, you get stuck in a dead loop, and your time is eaten up.

Failure to plan the pace of writing code, resulting in a question that could have been written in 15 minutes being dragged out to 30 minutes with no samples.

Want to hit the big time but have limited time?

Don't worry, we can provide you with full support:

OA Writing & Written ExamHackerRank: HackerRank, NiuKe.com, CodeSignal and other platforms full coverage, professional writers online ghostwriting, to ensure that all test cases 100% pass, do not pass without charge, remote and reliable operation without traces.

Interview Assist & VO AssistReal-time voice prompts + Ideas guide, so that you can deal with the interview, North American CS experts manual assistance, far more than the effect of simply brushing the questions.

Interview (full interview)The following are some of the most important features of the program: transfer camera + voice changing technology, team cooperation, multiple rounds of simulation in advance, to help you easily transform into a "flawless candidate", straight through the big factory Offer.

Full Escort & Offer GuaranteeFrom OA to technical interview to contract negotiation, one-stop service in the whole process, a small deposit in advance, and then pay the final payment when the Offer arrives, with very low risk.

More supportWe can provide professional support: mock interviews, face-to-face experience sharing, programming ghostwriting, resume optimization, algorithm tutoring, Quant interview assistance, and even international student admission ghostwriting.

If you are also preparing for a big factory, don't carry on alone. If you find the right helpers, you will be able to get the offer faster and more securely with fewer detours!

author avatar
jor jor
END
 0
Comment(No Comment)