harness logo
Harness· Senior Software Engineer

Harness | Senior Software Engineer | Round 1 (DSA)

Posted
10 Jul 2026
89 reads

Summary

I completed a 1‑hour DSA coding round for a Senior Software Engineer position at Harness; although I solved the streaming ingredient problem, I was rejected without any feedback.

How it went

The round was a 1hr DSA coding session. Right at the start, the interviewer explicitly anchored my expectations by saying: "Don't worry about optimizing the approach right now, just focus on giving me a working solution."

The problem was structured as a streaming array simulation puzzle.

There are 3 types of ingredients: "fat", "fib", and "carb".

Input: An integer n (number of days) and a list of strings representing ingredients arriving day-by-day.

Output: An array of 0s and 1s representing whether a dish can be cooked on that day.

Core Rules:

  • The chef must have at least 3 total ingredients available in stock.
  • Out of the 3 ingredients chosen, at least 2 must be of the same type (e.g., 2 fats + 1 carb).
  • The Chronological Constraint: If the chef has multiple options, the dish that came earlier in the timeline must be chosen.

My Solution Strategy

Because of the strict chronological requirement, simple frequency counters won't work—you completely lose track of when a specific item arrived.

I instinctively opted for a 3-Queue Approach (Queue<Integer> fat, fib, carb) to track the exact index/day of arrival for each item.

Inside the streaming loop, I checked if any queue size crossed the threshold to form a pair, and then used a peek comparison to greedily poll the single oldest remaining item from the other queues.

My Code (Passed all interview test cases)

Verdict

Rejected, No reason given.

Questions asked (1)

  1. 01

    Streaming Ingredient Cooking Decision

    Data Structures & Algorithms

    There are three ingredient types: "fat", "fib", and "carb". You receive an integer n representing the number of days and a list of strings indicating the ingredient that arrives each day.

    You must output an array of 0s and 1s (one per day) indicating whether a dish can be cooked on that day.

    Rules:

    • The chef must have at least three total ingredients in stock.
    • From the three ingredients selected for a dish, at least two must be of the same type (e.g., two fats and one carb).
    • If multiple valid dishes are possible on a given day, the dish that uses the earliest‑arriving ingredient must be chosen (chronological constraint).

    Return 1 for a day when a dish can be prepared according to the rules, otherwise 0.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Harness recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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