← GE HealthCare Interview Insights

GE HealthCare·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Had a coding round with GE HealthCare that was basically one algorithmic problem the whole time. Pretty focused session, nothing behavioral, just grind through the logic.

Questions Asked (1)

Q1

You're given a string of 'Y' and 'N' characters representing customer arrivals per hour. You pick a closing time j, and the penalty is the count of empty hours before j plus the count of customers who show up after j. Find the earliest closing time that minimizes this penalty.

Algorithms & Data Structures
Author's notes

Took me a minute to even parse what the penalty function was doing.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, restate the problem in your own words to confirm understanding, then propose an efficient algorithm. Use prefix sums to compute penalties for all possible closing times in O(n) time, and track the earliest index that achieves the minimum penalty.

Pro tip: Mention that you can compute the penalty in a single pass by maintaining counts of empty hours and customers after the current index, and update the minimum penalty and earliest index dynamically. This shows you can optimize both time and space.

1. Clarify the problem

Confirm that the string represents hourly arrivals, with 'Y' meaning a customer arrives and 'N' meaning no customer. The penalty for closing at hour j is the number of 'N's before j plus the number of 'Y's after j.

2. Define penalty formula

Let n be the length of the string. For a closing time j (0-indexed), penalty(j) = count of 'N' in s[0..j-1] + count of 'Y' in s[j..n-1]. Note that closing at j means the store is open for hours 0 to j-1.

3. Compute efficiently

Precompute total number of 'Y's. Traverse the string from left to right, maintaining the count of 'N's seen so far and the count of 'Y's remaining. At each index j, compute penalty(j) and update the minimum penalty and earliest index if a new minimum is found.

4. Handle edge cases

Consider closing at time 0 (all customers after are penalized) and closing at time n (all empty hours before are penalized). Also handle empty string or all 'Y'/'N' strings.

5. Return result

After the traversal, return the earliest index j that gives the minimum penalty. If multiple indices yield the same minimum, the first one encountered is the earliest.

Key Points to Mention

  • Time complexity: O(n) with a single pass, space complexity: O(1) extra space.
  • Use of prefix sums or running counts to avoid nested loops.
  • The penalty function can be rewritten as: total_N_before_j + total_Y_after_j.
  • Tie-breaking: choose the smallest index j when penalties are equal.
  • Edge cases: j=0, j=n, and strings with all same characters.
  • Potential to compute in one pass by updating counts dynamically.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.