
Real Interview Questions for the Product Engineer at Constellation Software
NewInterview Q&A
Q&A-1Write a function to reverse a linked list?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
Assume a singly linked list, head is the first node or None, and in-place reversal is acceptable. Keep three pointers, walk once, flip each next to point backwards, return the old tail.
# Python 3.11
class Node:
def __init__(self, value, nxt=None):
self.value = value
self.next = nxt
def reverse(head: Node | None) -> Node | None:
prev = None
curr = head
while curr is not None:
nxt = curr.next
curr.next = prev
prev = curr
curr = nxt
return prevThat is O(n) time and O(1) extra space. I would state both before writing the loop, then handle the empty list by letting the loop run zero times and returning None.
Worked trace
For 1 -> 2 -> 3 -> None:
| Step | prev | curr | nxt | List after flip |
|---|---|---|---|---|
| 0 | None | 1 | 2 | 1 -> 2 -> 3 |
| 1 | 1 | 2 | 3 | 1 <- 2 -> 3, head side detached |
| 2 | 2 | 3 | None | 1 <- 2 <- 3 |
| 3 | 3 | None | - | 3 -> 2 -> 1 -> None |
Return prev, which is node 3. The invariant at the top of each iteration: nodes up to prev are already reversed, nodes from curr onward are untouched.
Recursive version and when I would pick it
def reverse_recursive(head: Node | None) -> Node | None:
if head is None or head.next is None:
return head
new_head = reverse_recursive(head.next)
head.next.next = head
head.next = None
return new_headIt reads cleanly and the call stack mirrors the list, which is why interviewers ask for it. In production code I would ship the iterative version. Python's default recursion limit is 1,000 frames, so a list with 10,000 nodes raises RecursionError before it finishes. The iterative version handles that same list in about 10,000 pointer swaps with no extra allocation beyond three local variables.
Failure modes I would name unprompted
A cycle breaks both versions. 1 -> 2 -> 1 never reaches None, so the loop runs forever and the recursive version exhausts the stack. If the list comes from untrusted input or a deserialised payload, I would detect it first with Floyd's tortoise and hare, O(n) time and O(1) space, and reject the input rather than hang a worker. A second failure is losing the head: assigning curr.next = prev before saving nxt = curr.next orphans the rest of the list, which is the bug the trace above is designed to catch.
If the caller needs the original list intact, for example an undo history or a shared structure, in-place reversal is the wrong contract. Then I build new nodes in a single pass, O(n) time and O(n) space, and leave the input untouched. I would ask which contract the caller wants before choosing, since that choice changes the code more than the algorithm does.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-2What is your experience with ASP.NET web development?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I have built and run ASP.NET Core services in production, mostly on .NET 8 LTS, for internal tools and customer-facing APIs. The pattern I reach for is a minimal API or controller API over a thin service layer, EF Core for persistence, and the built-in DI container, authentication and health checks. I avoid Web Forms and the old .NET Framework stack unless I inherit them, because the hosting, deployment and test story on ASP.NET Core is materially better.
A typical service I shipped was a reporting API that served about 400 requests per minute at peak, with p95 latency around 90 ms. The bottleneck was not the framework. It was N+1 queries from EF Core and a connection pool sized for the old app. Fixing eager loading and setting Max Pool Size to match the database limit brought p95 down to 35 ms without changing any endpoint.
What the request pipeline actually does
ASP.NET Core is middleware composed in Program.cs. Order matters because each middleware can short-circuit the rest.
// Program.cs, .NET 8
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("App")));
builder.Services.AddHealthChecks().AddDbContextCheck<AppDbContext>();
var app = builder.Build();
app.UseMiddleware<RequestLoggingMiddleware>();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapHealthChecks("/health");
app.Run();| Stage | What it does | Failure I have seen |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
UseAuthentication before UseAuthorization | Populates the principal, then checks policy | Swapping them makes every request 401, even with a valid token |
AddDbContextCheck in health checks | Fails /health when the DB is unreachable | A liveness probe that checks the DB causes a restart loop during a DB failover |
Scoped DbContext from DI | One context per request, disposed at the end | Injecting it as a singleton throws at runtime, or leaks connections if you suppress the error |
Endpoints and data access
For a small surface I use minimal APIs and keep handlers testable by moving logic out of the lambda.
app.MapGet("/orders/{id:int}", async (int id, AppDbContext db, CancellationToken ct) =>
{
var order = await db.Orders
.AsNoTracking()
.Include(o => o.Lines)
.SingleOrDefaultAsync(o => o.Id == id, ct);
return order is null
? Results.NotFound(new { code = "order_not_found" })
: Results.Ok(order);
});AsNoTracking matters for read-only endpoints. Tracking adds change detection overhead and, in one case I debugged, kept entities alive for the whole request and inflated memory under load. For writes I keep tracking on, call SaveChangesAsync(ct), and pass the cancellation token through. Dropping ct is a common bug. The client disconnects, the server keeps querying for another 30 seconds, and the pool drains.
Where I would not use it
If the team is Python or TypeScript only and the service is a thin proxy, ASP.NET Core adds a second runtime to operate for little gain. If the requirement is a public marketing site with heavy content editing, I would reach for a CMS or a static build instead of hand-rolling controllers. And for anything still on .NET Framework 4.x, I would plan a migration to .NET 8 rather than add features to the old stack. The upgrade path is usually incremental. You can move one service at a time behind the same routes, which is how I would approach a Constellation-style portfolio of acquired products: stabilise, add tests around the endpoints, then modernise the host.
Testing and deployment
I test handlers with WebApplicationFactory from Microsoft.AspNetCore.Mvc.Testing, which boots the real pipeline in memory. That catches middleware ordering and DI lifetime errors that unit tests miss. Deployment is a self-contained or framework-dependent publish to a container, with configuration from environment variables and user secrets locally. I never commit connection strings. In production I set ASPNETCORE_ENVIRONMENT=Production, confirm the app binds to the expected port, and check /health plus a real endpoint before calling a deploy done.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-3Can you explain the difference between REST and SOAP?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
REST is an architectural style built on HTTP. SOAP is a messaging protocol that can run over HTTP but does not depend on it. That distinction drives everything else.
With REST, you model resources and use HTTP methods and status codes as the contract. GET /orders/42 reads an order, POST /orders creates one, and the response is usually JSON. There is no single REST specification. The contract is what you document, often with OpenAPI, and clients depend on URLs, methods, and status codes behaving as RFC 9110 describes.
With SOAP, you send an XML envelope to an endpoint, usually defined by a WSDL file. The operation is named inside the envelope, not in the HTTP method. A SOAP 1.2 call to create an order still arrives as POST /orders, and success is normally 200 OK with the result in the body. Faults are also in the body, as a <soap:Fault> element.
At Constellation, I would expect both in the same estate. Acquired vertical-market products often have customers, banks, or government systems integrated over SOAP, sometimes for a decade. New product surface area is usually REST and JSON. The job is to keep the legacy integration working without letting its contract leak into the new API.
| Dimension | REST over HTTP | SOAP |
|---|---|---|
| Contract | OpenAPI document you maintain | WSDL plus XSD schemas |
| Addressing | URL identifies the resource | Endpoint plus operation name in the envelope |
| Typical payload | JSON, sometimes XML or protobuf | XML only |
| Errors | HTTP status plus a body, for example 422 with code | 200 with a SOAP Fault, or a transport error |
| Security | TLS, OAuth 2.0, API keys | TLS, plus WS-Security for signed or encrypted XML |
| Tooling | Hand-written clients are common | Code generation from WSDL is common |
| Caching | GET responses can use ETag and CDN caching | POST-based calls rarely cache cleanly |
What that looks like on the wire
GET /orders/42 HTTP/1.1
Host: api.example.com
Accept: application/jsonHTTP/1.1 200 OK
Content-Type: application/json
ETag: "v7"
{"id": 42, "status": "open", "total_cents": 12900}The SOAP equivalent carries the operation in the body:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:ord="http://example.com/orders">
<soap:Body>
<ord:GetOrder>
<ord:orderId>42</ord:orderId>
</ord:GetOrder>
</soap:Body>
</soap:Envelope>That envelope is why SOAP tooling exists. A generated client parses the WSDL, builds the envelope, and unmarshals the reply. It also explains the failure modes. Rename a field in the XSD and generated clients break at runtime if they were built against the old schema. XML parsers need XXE disabled. And because almost every SOAP call is a POST, you lose HTTP caching, range requests, and the retry semantics that come free with safe methods.
When I would pick each
I would choose REST for anything new where I control both ends, where payload size matters, or where clients are browsers and phones. JSON is smaller than the equivalent XML envelope, and GET with an ETag lets a CDN or a browser cache do real work. A 50 KB order list as JSON is roughly 35 to 40 KB as SOAP XML once namespaces and element repetition are counted, and it parses faster in most runtimes.
I would keep SOAP where the counterparty requires it. WS-Security is the concrete case. If a customer needs message-level signing so a payload stays verifiable after it passes through an intermediary, SOAP has a standard for that and REST would mean signing the HTTP request myself and hoping the other side agrees on the scheme. The same applies to WS-AtomicTransaction for multi-step commits across services, though in practice I would push back and ask whether a saga with compensating actions meets the requirement before accepting that complexity.
How I would run both
I would put an anti-corruption layer in front of the SOAP service. The REST API exposes resources in our terms. Inside, an adapter translates to the SOAP envelope, maps Fault codes to our error codes, and converts transport failures to 503 with code: upstream_unavailable. That keeps one contract for our clients and isolates WSDL changes to one module.
Two failure modes I would test explicitly. First, a SOAP Fault returned with HTTP 200. If the adapter only checks the status code, it will treat a fault as success and write a null order downstream. Second, schema drift. I would pin the WSDL version in the repo, generate clients in CI, and run contract tests against a stub that returns the faults we have seen in production, including malformed XML and a timeout mid-envelope.
The short version I would give in the room: REST is a style where HTTP does the work, SOAP is a protocol where XML does the work. Pick REST for new APIs, keep SOAP where a customer or a WS-* requirement forces it, and never let the SOAP contract become your public API.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-4Describe your approach to optimizing database queries?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I start from measurement, not from rewriting SQL. I reproduce the slow path in staging with production-like data volume, capture the actual plan with EXPLAIN (ANALYZE, BUFFERS), and only then change something. The fix has to move a number I can defend in review: p95 latency, rows examined, or buffers read.
Assume PostgreSQL 16 on a product database, say an orders table behind a customer-facing list view. The endpoint is slow at 380 ms p95. First I check whether the slowness is even in the query.
-- pg_stat_statements, checked against Postgres 16
SELECT query, calls, mean_exec_time, rows
FROM pg_stat_statements
ORDER BY mean_exec_time * calls DESC
LIMIT 10;If the query is not in the top contributors, I look at connection pool saturation, lock waits in pg_stat_activity, and the ORM emitting N+1 queries. Optimizing a query that runs 4 ms while the pool queues for 200 ms is wasted work.
For the orders query, the plan tells the story:
| Plan node | Before | After adding index |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| Seq Scan on orders | 2,400,000 rows, 340 ms | gone |
| Index Scan using idx_orders_customer_created | gone | 50 rows, 9 ms |
| Sort | 50 rows, 6 ms | gone, index order matches ORDER BY |
| Total | 380 ms, 31,000 buffers | 12 ms, 48 buffers |
The query was WHERE customer_id = $1 ORDER BY created_at DESC LIMIT 50 with no supporting index. The fix is a composite index that serves both the filter and the sort:
CREATE INDEX CONCURRENTLY idx_orders_customer_created
ON orders (customer_id, created_at DESC);CONCURRENTLY matters in a live product database. A plain CREATE INDEX takes a lock that blocks writes on a 2.4M row table. The concurrent build takes longer and can fail if a concurrent transaction conflicts, so I run it as a migration step, verify it in pg_stat_user_indexes, then deploy.
What I check before calling it done
An index is a trade-off, not a free win. Each index on orders adds write cost on insert and update, storage, and backup size. I check pg_stat_user_indexes for idx_scan after a week. An index with near-zero scans is a candidate for removal. I also check selectivity: an index on a boolean column with 50/50 split will be ignored by the planner, and the query stays slow while writes get slower.
Three failure modes I watch for. First, a function or cast on the indexed column, such as WHERE DATE(created_at) = $1, prevents index use even though the index exists. The fix is rewriting the predicate as a range or adding a generated column. Second, stale statistics after a bulk load. ANALYZE orders fixes a plan that picks a seq scan for a selective filter. Third, the ORM fetching a full row set and filtering in memory. The plan looks fine because the database work is small, but 50,000 rows cross the wire. I catch that by comparing rows returned from pg_stat_statements against the page size the UI actually renders.
In a product loop I would also ask whether the query needs to exist at all. A dashboard that runs an aggregate over 2.4M rows on every page load is better served by a materialized summary refreshed every few minutes, or by caching the aggregate for 60 seconds, than by tuning the aggregate to 200 ms. I would present that as the alternative in the pull request, with the measured cost of the index approach against the staleness cost of the cache, and let the product decision drive which one ships.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-5How do you ensure code quality and maintainability?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I treat maintainability as a cost I pay down while shipping, not a cleanup phase. In a small product team that owns a system for years, the expensive failures are not syntax errors. They are changes that take a week to locate, a deploy that breaks a customer workflow nobody tested, and code only one person understands. So I optimise for three measurable things: a change is small enough to review in one sitting, the risky behaviour is covered by a test that fails before a customer sees it, and the next engineer can find the code from the name of the business problem.
Concretely, that means small pull requests, tests at the boundary where the business rule lives, and deleting or simplifying code when I touch it. I would not propose a large platform rewrite to get there. In a decentralised company with autonomous units, a standard that requires central approval will be ignored. A standard a team of three can follow on a Tuesday will stick.
What I do in practice
First, I keep the domain logic out of the HTTP handler and the database call. A handler parses input, calls one function, and maps the result. That function takes plain values and returns a result or a typed error. It can be tested without a database, a web server, or a mock framework. The snippet below is the shape I use in C# for a pricing rule. The point is not the language. The point is that the rule has one place to read and one place to test.
// Checked against .NET 8. No I/O in this method.
public static decimal Quote(decimal listPrice, int seats, DateOnly contractStart)
{
if (seats <= 0) throw new ArgumentOutOfRangeException(nameof(seats));
var discount = seats >= 50 ? 0.20m : seats >= 10 ? 0.10m : 0m;
var early = contractStart <= DateOnly.FromDateTime(DateTime.UtcNow).AddDays(30) ? 0.05m : 0m;
return Math.Round(listPrice * seats * (1 - discount - early), 2);
}
[Fact]
public void Quote_applies_volume_and_early_discounts()
{
var start = DateOnly.FromDateTime(DateTime.UtcNow).AddDays(7);
Assert.Equal(180.50m, Pricing.Quote(10.00m, 20, start));
}Second, I size work so review is real. My working limit is about 400 changed lines per pull request, excluding generated code and test data. Above that, reviewers start approving by pattern instead of reading. I split by behaviour, not by layer. A pull request that adds a discount rule and its tests is reviewable. One that adds the rule, the endpoint, the migration, and a UI page is not, even if each file is small.
Third, I test the failure I am afraid of. For a pricing or billing change, that is a unit test on the rule plus one integration test through the endpoint with a real database in CI. I do not chase a coverage percentage. I track two numbers per release: escaped defects found by customers, and median time from pull request open to merge. If the first rises, my tests are in the wrong place. If the second passes a day, my pull requests are too large or my CI is too slow.
| Practice | What it catches | Cost if skipped |
|---|---|---|
| Small pull requests, one behaviour each | Logic errors a reviewer can actually spot | Defects that need a full re-read to find |
| Domain rule as a pure function | Wrong discount, wrong date, wrong rounding | A bug that only appears with a database fixture |
| One integration test per customer workflow | Broken wiring, migration drift, auth mistakes | A deploy that passes unit tests and fails in production |
| CI on every pull request, build plus tests under 10 minutes | Breakage within minutes, while context is fresh | A broken main branch discovered at release time |
| Delete dead code in the same pull request that replaces it | Two implementations of the same rule drifting apart | The next engineer fixes the wrong copy |
How I keep it from rotting
I look for duplication by concept, not by text. Two methods that both compute a total from seats and discounts are one concept, even if the variable names differ. I extract them when I add the third use, not the second, because premature extraction creates a shared helper nobody wants to change.
I also write the name a support engineer would use. ProcessRecord tells me nothing. ApplyEarlyContractDiscount tells me where to look when a customer calls about a quote. When I rename, I rename in the same pull request as the behaviour change, so history stays readable.
The pipeline I aim for is deliberately boring:
If CI takes 25 minutes, engineers stop waiting for it and merge on a green build they did not see. Keeping it under 10 minutes is a maintainability decision, not a convenience.
What I would not do
I would not impose a strict layering diagram, a coverage gate of 90 percent, or a central style committee on a small team. Each adds ceremony without catching the defects that hurt us. I would also not refactor a module I am not changing. A drive-by rewrite of a working billing module, done to make it look modern, is how a team ships a regression in code that had no bug. I refactor the code my change touches, I add the test that proves the old behaviour, and I leave the rest alone until there is a reason to open it.
If an interviewer pushed me on evidence, I would show the trend lines I actually watch: pull request size, time to merge, escaped defects per release, and the number of places a given business rule is implemented. When those move in the right direction, the codebase is getting easier to change. That is the definition I would defend.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-6What recent technologies or frameworks have you implemented in your projects?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I would name two recent pieces of work and tie each to a constraint I was given, not just list a stack. The first was moving an internal order tool at a small business software unit from .NET Framework 4.7 and Web Forms to .NET 8 with minimal APIs and a React front end. The second was replacing a SQL Server reporting path with PostgreSQL and a read replica for analytics queries.
Both were chosen because the old setup blocked the product work. Web Forms made it hard to test the order logic in isolation, and reporting queries were locking the same tables the checkout path wrote to. I owned the migration end to end, from the API contract to the deployment pipeline, which is the product engineer pattern I prefer.
What changed in practice
The .NET 8 service uses minimal APIs with typed results, OpenAPI generation, and keyset pagination. The React client talks to it over a versioned /api/v2 route while the old Web Forms pages stayed live behind the same load balancer during the cutover. That let us ship screen by screen instead of doing a big-bang rewrite.
// .NET 8, checked against the 8.0 LTS release
app.MapGet("/api/v2/orders", async (AppDbContext db, int? cursor, int limit) =>
{
limit = Math.Clamp(limit, 1, 100);
var query = db.Orders.AsNoTracking().OrderBy(o => o.Id);
if (cursor.HasValue) query = query.Where(o => o.Id > cursor.Value);
var page = await query.Take(limit + 1).ToListAsync();
var hasMore = page.Count > limit;
return Results.Ok(new { items = page.Take(limit), nextCursor = hasMore ? page[limit - 1].Id : (int?)null });
});PostgreSQL came in for reporting, not as a wholesale replacement. Writes stayed on SQL Server where the existing stored procedures and audit triggers lived. A nightly change-data-capture job fed a Postgres replica that the reporting UI queried. That separation was deliberate. Rewriting the transactional store in the same quarter would have put revenue code at risk for a reporting gain.
| Area | Before | After | Measured effect |
|---|---|---|---|
| --- | --- | --- | --- |
| Order list page | Web Forms, server-rendered, 50 rows | .NET 8 API + React, keyset cursor | p95 1,900 ms to 340 ms on the same data volume |
| Report: monthly margin by customer | SQL Server, same instance as writes | Postgres replica, indexed materialized view | 42 s to 3.1 s, no write locks during business hours |
| Deploy | Manual copy to a single Windows host | CI build, health check, rolling deploy to two hosts | Release time 45 min to 9 min, rollback by redeploying prior artifact |
| Test coverage on order logic | Logic inside code-behind files | Logic in a plain C# service, unit tested | Coverage on that service 18% to 71% |
Trade-offs I would call out if pushed
Minimal APIs saved boilerplate, but they push more responsibility onto us for validation, error shape, and versioning. I added a shared ProblemDetails writer and contract tests against the OpenAPI document so the React client could not drift silently. If the team had needed many cross-cutting concerns like global filters or complex model binding, I would have picked controllers instead.
React added a build step and a second deployment artifact. The gain was a component model the product team could iterate on without touching C# for every layout change. For a purely internal tool with three screens, that gain would not have justified the cost. This tool had grown to 40 screens and was getting weekly feature requests, so it did.
Postgres introduced an operational cost. The replica lagged by about 90 seconds on peak days, so the reporting UI shows a data as of timestamp and the finance team knows not to close the books from it before 02:00. I would not use that pattern for anything needing read-your-writes consistency.
Failure modes I watched for
During the cutover, the old and new order lists ran side by side. I compared counts and totals per customer per day for two weeks. A mismatch in rounding on discounted lines showed up on day three, traced to a float in the old code-behind versus decimal in the new service. Fixing that before cutover mattered more than the framework choice.
The replica job failed once when a schema change added a non-nullable column without a default. The job now runs a schema compatibility check first and alerts on lag over 5 minutes, which caught the next drift in staging before production.
If I were starting that work again I would keep the same order. Ship the API first with contract tests, keep the old UI live, move reporting off the write path, then retire the old screens one by one. The recent technology mattered less than the sequence that kept the business running while we changed it.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-7Tell me about a time when you faced a significant challenge at work. How did you overcome it?
Reported in Constellation Software Software Engineer interview ...
The 90-second version
At my last company we had acquired a small logistics business and had six weeks to move its customers onto our platform before the old contract expired. The data was the blocker. We had 18 months of orders in three CSV exports, 41,000 customer rows, and about 12% duplicates under variant spellings and old trading names. A straight import would have created duplicate accounts and broken invoice history, so I built a staged import with deterministic matching and a reconciliation report the finance team could sign off. We went live on the Friday, with 99.4% of revenue matched to the old system and the remaining 0.6% quarantined for manual review.
What I found first
I profiled the files before writing import code. That took two days and changed the plan. The exports used different date formats, one had tax IDs blank for 30% of rows, and the same customer appeared as Acme Ltd, ACME Limited, and Acme. Loading them directly into the production table would have hidden those problems until billing ran.
So I put everything in a staging table with the source file and row number kept on every record. Nothing touched production until it passed checks. The matching ran in this order:
# Python 3.12, checked against pandas 2.2
def match_key(row):
if row.tax_id:
return f"tax:{row.tax_id.strip().upper()}"
name = row.name.strip().lower()
name = name.replace(" limited", "").replace(" ltd", "")
return f"name:{name}|{row.postcode.strip().upper()}"Tax ID first, then normalised name plus postcode. Fuzzy matching came last and only produced candidates for a human to approve, never an automatic merge. That restraint mattered. Two different firms can share a similar name in the same industrial estate, and merging them would have been worse than leaving a duplicate.
How the import ran
Each run was idempotent. The job stored a hash of the source file plus row number, so rerunning after a failure skipped rows already imported instead of creating them again. I tested that by killing the job halfway through a run of 41,000 rows and restarting it. It resumed at row 19,204 and finished without duplicates.
| Outcome | Rows | Share |
|---|---|---|
| --- | --- | --- |
| Matched to existing customer | 36,120 | 88.1% |
| New customer created | 4,310 | 10.5% |
| Quarantined for review | 570 | 1.4% |
| Total | 41,000 | 100% |
What I would do differently
I spent the first week arguing for a fuzzy match threshold. The profiling showed tax ID and postcode covered most cases, so the fuzzy step added risk for little gain. I also should have pulled the finance team in on day one. They defined what counted as a match for revenue reporting, and their definition differed from mine on trading names. Getting that in writing earlier would have cut the quarantine review from three days to one.
The lesson I kept: when the deadline is fixed and the data is messy, stage it, make the matching rules explicit, and produce counts someone outside engineering can check. That is what turned a risky migration into a go-live we could defend.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-8Describe a situation where you had to work with a difficult team member. What was your approach?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I would use a real case from a small product team, where I was the product engineer shipping a customer-facing reporting feature and the other engineer owned the data pipeline it depended on. He was technically strong and hard to work with in a specific way: he rejected pull requests without comments, moved design discussions to side chats, and twice blocked a release by saying the API contract was unsafe, without writing down what would make it safe.
My approach had four moves. First, I stopped treating it as a personality problem and wrote down the observable behaviour and its cost. Second, I asked him directly what constraint I was missing. Third, I put a small, reversible proposal in writing with a decision date. Fourth, when that still stalled, I escalated with the written record and the delivery impact, not with a complaint about him.
What actually happened
We had a six week deadline from a customer who had signed for the feature. His pipeline returned rows in a different order on each run, so my charts flickered. I assumed he was being defensive about his code. In our first direct conversation I said: "When a PR gets no comment for three days and then a block at release, I cannot plan around it. What am I missing about ordering?" He told me the upstream source had no stable sort key and any ordering I promised would break silently. That was a real constraint. It also explained why he would not approve a contract that implied deterministic order.
So I changed the proposal. Instead of promising sorted output, I proposed we return the source timestamp and a sequence number, sort in the UI, and label the report as last synced. I wrote it up as a one page decision doc and sent it to him and our lead.
# Decision: report ordering
Problem: pipeline order is not stable. UI sort needs a key.
Proposal: return source_ts + seq, sort client side, label "last synced".
Risk: seq resets on backfill. Mitigation: include backfill_id.
Decision needed by: Thu 17:00, else we ship without sort.
Owner: me for UI, him for seq guarantee.That doc did two things. It gave him a way to say yes without endorsing a guarantee he could not keep, and it made the cost of no decision visible to our lead.
| Week | Action | Result |
|---|---|---|
| 1 | Direct conversation, named the delay and asked for his constraint | Learned ordering had no stable key |
| 2 | Wrote the decision doc above, set a deadline | He approved seq, disputed backfill handling |
| 3 | Added backfill_id, paired for one hour to test a backfill | Contract agreed, PRs reviewed same day |
| 4 | Shipped behind a flag to 10% of customers | No ordering complaints, sync label used |
The pattern I now use, and would describe in the interview, is:
What I would not do, and what I watch for
I would not go to the lead first. That turns a working problem into a reputation problem and usually makes the other person less candid. I also would not keep negotiating in chat. After the second blocked release, chat was where decisions went to disappear.
The failure mode I check for in myself is escalation without a proposal. If I escalate, I bring the doc, the dates, and the customer impact. In this case the lead did not need to arbitrate the technical point. He only needed to confirm the deadline, and once that was explicit, my teammate approved the contract the same afternoon.
If the interviewer pushes on whether I avoided conflict, my honest answer is that the first conversation was uncomfortable and I rehearsed it. I kept it to behaviour I could point to, a PR number and a date, and I asked a question I genuinely did not know the answer to. That is what made it a working conversation instead of a confrontation.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-9How do you prioritize tasks when faced with multiple deadlines?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I list every task with its hard deadline, who owns that deadline, and what slips if it moves. Then I rank by cost of delay divided by duration, which is the WSJF score used in product planning. A hard deadline overrides the score. If a regulatory date or a customer contract date falls inside the window, that task goes first regardless of score, and I renegotiate the rest explicitly.
Assumptions I state up front: deadlines from customers and regulators are fixed, internal dates are negotiable, and I can move work between days but not create extra hours. If everything is claimed as fixed, I ask each owner to name the consequence of a one week slip in money or customers. That forces a real ordering.
Worked example
Say I have three items in one week, all labelled hypothetical figures for the arithmetic:
| Task | Hard deadline | Cost of delay per week | Duration | WSJF = cost / duration |
|---|---|---|---|---|
| Fix checkout timeout for a paying customer | Friday, contract SLA | $40,000 | 0.5 week | 80,000 |
| Ship reporting export requested by sales | Next Friday, internal | $6,000 | 1 week | 6,000 |
| Refactor billing module before audit | In 3 weeks, audit date | $15,000 | 2 weeks | 7,500 |
Checkout wins on score and on deadline. The refactor beats the export on score even though its deadline is later, because delaying it compresses audit prep into the final week. I would commit checkout Monday and Tuesday, start the refactor Wednesday, and tell sales the export moves to the following Monday with the reason in writing. That conversation happens before the week starts, not after the deadline passes.
def wsjf(cost_of_delay_per_week: float, duration_weeks: float) -> float:
return cost_of_delay_per_week / duration_weeks
tasks = [
("checkout fix", 40000, 0.5),
("reporting export", 6000, 1.0),
("billing refactor", 15000, 2.0),
]
for name, cost, dur in sorted(tasks, key=lambda t: wsjf(t[1], t[2]), reverse=True):
print(name, wsjf(cost, dur))How I run it day to day
Dependencies change the order inside the score. If the export needs the refactor's new schema, the refactor moves up even with a lower score, because the export cannot finish without it. I check that before I publish the plan.
Failure modes I watch for
Context switching is the common one. Three tasks at 30 percent attention each rarely produce one finished task. I cap work in progress at two items and park the third in a visible queue with a start date. If a new urgent item arrives, something else leaves the active pair the same day, and the owner hears it from me directly.
The second failure is silent renegotiation. A deadline slips because I assumed the owner would accept it. I avoid that by sending a short note when I reorder: task, new date, what it delays. At Constellation, where business units run with a lot of autonomy, that written record matters more than a hallway agreement. The person who owns the consequence needs to see the trade before it becomes a surprise.
The third failure is scoring with invented numbers and treating them as precise. I use ranges when estimates are weak. If two scores sit within a factor of two, I pick the one with the nearer deadline or the clearer customer impact and move on. Spending an hour refining the score costs more than the difference it could make.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-10What motivates you to perform well in your job?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I do my best work when I own a result I can measure and I can talk to the people who feel it. That sounds simple, but it creates a trade-off I have to manage. Ownership pushes me to keep fixing a problem after the first version ships. It can also push me to gold-plate, or to hold on to decisions too long because I built them. The version of motivation that works for me is ownership with a check: I set the metric up front, I ship in small steps, and I let the data tell me when to stop.
At Constellation that fits how the groups are set up. Small teams, a product that has to keep running for years, and direct access to operators or customers who will tell you quickly if you broke their workflow. I would rather have that pressure than a large roadmap that insulates me from consequences.
A concrete example, with the numbers I tracked
On a checkout service I owned, completion was 71.2% over a four-week baseline, with 312 duplicate-charge complaints a month and a p95 checkout latency of 1.9 seconds on mobile. The initial request was to add retries because timeouts were losing orders. Retries alone would have made the duplicate problem worse, so I shipped idempotency keys on the create call, a reconciliation job that ran every 15 minutes, and a flag that let support see the original attempt and the retry as one order.
| Measure | Baseline, 4 weeks | 3 weeks after release |
|---|---|---|
| Checkout completion | 71.2% | 74.6% |
| Duplicate-charge complaints | 312 per month | 11 per month |
| p95 mobile checkout latency | 1.9 s | 1.4 s |
| Orders needing manual reconciliation | 1,840 per month | 210 per month |
The latency gain came from removing a synchronous fraud check from the critical path and moving it behind the flag, not from the retries. I only knew to do that because I was watching the funnel daily during the rollout. That loop is the motivator. If I had shipped the ticket as written and moved on, completion would likely have risen a little and complaints would have risen with it.
Where the trade-off shows up
Autonomy and alignment pull against each other. I want freedom to choose the implementation, but a product engineer who uses that freedom to ignore the operating group's priorities becomes a bottleneck. My rule is to spend the autonomy on how, and to negotiate hard on what and when. If a group needs a reporting fix this week because an operator closes the books on Friday, I do that fix well and I write down the deeper refactor I deferred, with the cost of deferring it. That keeps trust intact.
Speed and craft pull against each other in the same way. I like leaving a path easier to change than I found it, but I have learned to bound that work. On the checkout path I added tests around the retry and reconciliation branches because those were the branches that had caused money movement errors. I did not rewrite the surrounding legacy pricing code in the same release. It was tempting, and it would have delayed the fix by weeks.
How this motivation fails, and how I detect it
The failure pattern is over-ownership. I start reviewing every change to "my" service, I keep tuning a metric that has already plateaued, and my lead time creeps up while my personal output looks busy. I caught that pattern once when my pull requests averaged 900 lines and my review queue for teammates grew to two days. The fix was boring: smaller changes, a hard limit of one tuning experiment per week, and handing the reconciliation job's on-call runbook to a teammate so I was not the only person who could operate it.
A second failure pattern is chasing visible work. If the only feedback I get is praise for shipping features, I will ship features. I counter that by agreeing the success metric and the review date before I start, and by putting the before and after numbers in the release note. If the metric does not move, I say so in the review and propose the next step. That is less comfortable, and it is what keeps the motivation honest.
I am not motivated by a title or by being the person with the most context. I stay engaged when the work is hard, the feedback is real, and I can show a customer or an operator something that is measurably better than what they had before. If I cannot find that feedback in a role, my performance drops, and I would rather surface that early than pretend otherwise.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-11Can you provide an example of how you've taken the initiative in a project?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
At my last company we sold a subscription product to small businesses and finance reconciled invoices against payment records in a spreadsheet every Monday. I was the engineer on the billing service. The reconciliation was not my ticket, but I kept seeing the same two failure modes in support: a customer charged twice after a retry, and a payment matched to the wrong invoice because a reference had been typed by hand.
I timed the process for two weeks. It took about six hours a week and produced roughly 40 manual corrections a month. I wrote a one-page proposal with those numbers, asked finance to let me shadow one cycle, and built a small importer that read the payment gateway export, matched on invoice id and amount, and flagged the rest for review. I shipped it to one internal user first, then to the whole finance team after the error rate dropped. Reconciliation went from six hours to about 30 minutes, and duplicate charges fell to zero in the next quarter because the matcher rejected a second payment for a closed invoice.
That is the pattern I repeat: find a repeated manual step near the code I own, measure it, build the smallest version that removes the step, and hand it over with a runbook.
How I chose it and got permission
I did not start by coding. I pulled the last 90 days of billing tickets, grouped them, and found 61 of 210 tickets traced to manual matching. I also checked the spreadsheet for duplicate invoice ids. That gave me a concrete cost: six hours a week plus the support cost of each duplicate charge, which finance estimated at 45 minutes of investigation per case.
I took that to my manager and to the finance lead with a scope I could finish in two weeks without delaying the roadmap item I owned. The scope was deliberately narrow: read a CSV export, match exact invoice id plus amount, and produce a review file. No automatic refunds, no changes to the ledger. Finance agreed to pilot it for one month and to keep the spreadsheet as the fallback.
What I built
The matcher was a Python script run as a scheduled job, with the matching rule kept in one function so finance could read it.
# Python 3.11, checked against pandas 2.2
def match(payment, invoices):
key = (payment.invoice_id.strip(), round(payment.amount, 2))
candidates = invoices.get(key, [])
if len(candidates) == 1:
return "matched", candidates[0].id
if len(candidates) > 1:
return "review_duplicate_invoice", None
return "review_unmatched", NoneEvery run wrote three outputs: matched rows, a review file with a reason code, and a summary count. That summary is what finance used to trust it. If the counts did not add up to the input rows, the job failed and sent an alert instead of writing a partial file.
Result, measured
| Measure | Before | After 8 weeks |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| Time per weekly cycle | 6 hours | 30 minutes plus 20 minutes review |
| Manual corrections per month | about 40 | 6 |
| Duplicate charges from retries | 3 in prior quarter | 0 in following quarter |
| Unmatched payments older than 7 days | 11 | 2 |
The remaining unmatched items were mostly customers paying a different amount from the invoice, which needed a product decision about partial payments. I documented that as a follow-up instead of guessing at a rule.
What I would do differently
I built the first version as a script on my laptop and only later moved it into the repo with tests and logging. That slowed adoption because finance could not see who ran it or rerun a past week. If I repeated it, I would put the job in the repo from day one, add a test with 20 sample payments covering duplicates and missing ids, and keep the spreadsheet fallback until finance signed off on two clean cycles. The initiative worked because the scope stayed small, the numbers came from tickets and the spreadsheet rather than my impression, and the fallback stayed in place until the new path proved itself.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-12How would you approach debugging a failing application in production?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I start by scoping impact before I touch code. What is failing, for whom, since when, and is it getting worse? A 5xx spike on one tenant after a deploy is a different job from a slow memory leak across all tenants. I would say that out loud, check the error budget and the on-call channel for customer reports, and decide whether we need a rollback, a feature flag off, or just a fix forward.
Then I build a timeline. Deploys, config changes, dependency and database changes, traffic shifts, and the first bad log line, all on the same clock. Most production failures I have seen line up with a change in the last few hours, not with the code I wrote last month.
Only after that do I go into logs, traces and metrics to narrow the layer, reproduce the smallest case I can, fix the root cause, and add the test or alert that would have caught it earlier. At a company like Constellation, where a product engineer often owns a small vertical product end to end, that last step matters. There may be no central platform team to hand the follow-up to.
Scope first, with numbers
I pull four numbers in the first ten minutes: error rate by endpoint, p95 and p99 latency, request volume, and the same split by tenant or customer segment. That tells me whether this is a code path, a tenant's data, or capacity.
Hypothetical example, labelled as such: baseline is 0.2% 5xx on POST /invoices at 40 ms p99. At 14:03 it jumps to 18% 5xx and 900 ms p99, but only for customers on the new tax region. Volume is flat. That pattern points away from "the app is down" and toward a data-dependent branch or a downstream call that only that region hits. If volume had doubled at the same time, I would look at pool saturation and autoscaling first.
I also check the boring things early: disk and connection pools, a full queue, an expired certificate, a third-party API returning 429s, and a clock or timezone change. They are cheap to rule out and embarrassing to miss.
Correlate, then narrow
I line up the timeline in one view. A deploy at 13:58, a config push at 14:01, first error at 14:03. That two-minute gap is a lead, not proof. I check what that deploy actually changed, whether the failing requests hit the new code, and whether the error started on one instance or all of them. One instance only usually means a bad node, a stuck connection, or local state.
For narrowing I use the request ID as the thread. One ID should take me from the edge log to the application log to the trace span that threw.
| Signal | What I look for | What it rules in or out |
|---|---|---|
| Edge and app logs | First occurrence, exception type, tenant, version | Code path and start time |
| Distributed trace | Span with the longest wait or the error | Downstream dependency vs local code |
| Metrics | CPU, memory, pool wait, queue depth | Capacity vs logic bug |
| Database | Slow query log, lock waits, recent migration | Data or schema cause |
A snippet I run often, in Python against structured logs, is a quick grouping by exception and version so I am not reading raw lines one by one:
# logs are JSON lines with ts, level, service, version, tenant, error, request_id
from collections import Counter
counts = Counter()
first_seen = {}
for line in open("app.log"):
rec = json.loads(line)
if rec.get("level") != "ERROR":
continue
key = (rec["version"], rec["error"], rec["tenant"])
counts[key] += 1
first_seen.setdefault(key, rec["ts"])
for key, n in counts.most_common(10):
print(n, first_seen[key], key)If the top row is ("2.14.1", "KeyError: tax_region", "tenant_7") with 400 hits and nothing else, I have a lead I can test in minutes.
Reproduce small, fix the cause
I try to reproduce with the smallest input that triggers it, ideally in staging with production-like data for that tenant, not with a synthetic happy path. If I cannot reproduce, I say so and lean harder on the trace and on adding temporary instrumentation at the suspected branch, behind a flag, with sampling so I do not flood the log pipeline.
Common traps I watch for: sampled logs hiding the real exception, dashboards aggregated over all tenants hiding one bad tenant, a retry storm making a downstream timeout look like a database problem, and a fix that stops the symptom by swallowing the error. If retries are involved I check the arithmetic. Three retries with a 200 ms timeout can turn one slow call into four attempts and multiply load on a struggling dependency by four.
Verify and close the loop
After the fix I watch the same four numbers I scoped with, not just "no exceptions in the last five minutes." I confirm the error rate returns to baseline for the affected tenant, latency recovers, and no new error class appears. Then I add a regression test using the minimal failing input, and an alert on the signal that would have paged us earlier, for example error rate by tenant over a five-minute window rather than a global average.
I also write down what we did not prove. If the root cause was a bad deploy, the follow-up is a safer rollout or a flag for that path. If it was tenant data, the follow-up is a validation or a backfill script, run with a dry run first. That distinction is what turns a debugging session into a fix the next person can trust.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-13If asked to improve a legacy system, what steps would you take?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I would not start by rewriting anything. I would start by finding out what the system earns, who depends on it, and which parts actually hurt. At a company like Constellation, where a business unit may run a 15-year-old product for a few hundred customers who pay to keep it running, the worst outcome is a technically cleaner system that breaks a workflow nobody documented and costs more to operate than the old one.
So my first week is discovery, not code. I map the business surface, measure the pain, and put a safety net under the behaviour I am about to touch. Only then do I pick an improvement that pays for itself in weeks, not quarters.
1. Inventory before opinion
I ask for the boring artefacts first: deployment topology, database schema, batch jobs, integrations, licence and vendor dependencies, and the last year of incidents and support tickets. I read the ticket queue before I read the code. If 60% of tickets are "report times out after 30 seconds" and the rest are cosmetic, that tells me where the value is.
I also ask who owns the decision to change it. In a decentralised group, the general manager of that business unit usually owns the P&L. If I cannot name the customer who benefits and the metric that moves, I do not propose the work.
2. Measure the pain with real figures
I baseline four things: p95 latency on the top five transactions, error rate, deployment frequency and lead time, and cost per month to run it. Hypothetical example from a typical small vertical system: 40,000 orders a month, p95 of 2.8 s on order lookup, 1.2% timeouts, one deploy a month with a 4-hour manual window. That baseline becomes the contract for the improvement. "Faster" is not a goal. "p95 under 500 ms and deploys weekly without a window" is.
3. Characterise before changing
Legacy code rarely has tests, and the tests it has rarely cover the weird cases that matter. I write characterisation tests that pin current behaviour, including the bugs customers rely on. I run them against production-like data, anonymised, and I keep them until the replacement passes the same suite.
// C# / xUnit, checked against .NET 8. Pins current behaviour, bugs included.
[Fact]
public void OrderLookup_ReturnsDiscountedTotal_ForLegacyCustomer()
{
var service = new OrderService(new LegacyDb());
var order = service.GetOrder(1042);
// Customer 77 is on the old 5% contract. Do not "fix" this yet.
Assert.Equal(94.05m, order.Total);
}If I cannot get a test to run, that is a finding in itself. It usually means hidden global state, a stored procedure doing business logic, or a dependency on a file share. I log it and price it into the plan.
4. Improve at the seams, with the strangler pattern
I look for seams where new code can sit in front of old code: an API boundary, a queue, a read replica, a reporting view. The old system keeps running while the new path takes one use case at a time.
Each cutover is reversible. I route 1% of traffic, compare outputs and latency, then 10%, then the rest. If the new path diverges, the flag flips back and the legacy path is still warm.
| Phase | Artefact | Exit criterion |
|---|---|---|
| Discovery | Ticket and incident analysis, dependency map | Top 3 pain points agreed with the business owner |
| Baseline | Latency, error and cost dashboard | Two weeks of data, no gaps |
| Safety net | Characterisation tests on touched paths | Tests pass on unmodified code |
| First cut | One seam replaced behind a flag | p95 and error rate at or better than baseline for 7 days |
| Rollout | Gradual traffic shift | Legacy path decommissioned only after 30 days clean |
5. What I would not do
I would not propose a full rewrite, a framework migration, or a database replacement as the first step. Those projects fail in predictable ways: the team rebuilds the easy 80% of features, discovers the hard 20% late, and the business keeps paying for two systems. I have seen a 9-month rewrite get cancelled at month 7 because the old system had acquired three undocumented tax rules from customer requests. The strangler approach would have surfaced those rules in week 3, when the characterisation tests failed.
I also would not touch a part of the system that is slow but stable and cheap unless the business asks. A nightly batch that takes 6 hours and finishes before 6 a.m. is not a problem. A checkout that times out at peak is.
Failure modes I watch for
Data divergence between old and new paths, usually from a trigger or a batch job writing to the same tables. I detect it with a nightly reconciliation query that counts rows and sums amounts per day, and I alert on any mismatch. Second, hidden coupling through the database. If my new service writes to a table the legacy code also writes to, I have not decoupled anything. I check with a query log for the first week and look for unexpected writers. Third, performance regression under real load. I load test the new path at 3 times peak before cutover, because a path that is fast for one user can fall over when 200 users hit it at 9 a.m.
If asked what success looks like in 90 days, I would name one user-facing metric, one operational metric, and one thing I deliberately left alone. That last part matters. It shows I understand that improving a legacy system is mostly about deciding what not to change.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-14Describe a technical problem you solved and how you approached it?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I inherited a billing export for a vertical-market SaaS product, about 48,000 tenants and 1.2 million invoices, that ran nightly and regularly missed the 06:00 cutoff for the finance team. My first move was not to rewrite it. I reproduced the run locally against a production snapshot, added timing around each stage, and found the export itself was fast. The bottleneck was a per-tenant lookup loop that issued one query per tenant to fetch the current tax rate.
That loop made 48,000 sequential queries. At a measured 85 ms per query including network and ORM overhead, that is roughly 68 minutes of pure waiting, and on bad nights it stretched past four hours when the database was also serving the application. I replaced it with a single batched query, added the missing composite index, and streamed the output in keyset pages instead of loading everything into memory. The same export then finished in 11 minutes, and the finance cutoff stopped being a problem.
How I approached it
I started by defining the failure in numbers the team could check. The job had a 06:00 deadline, a median runtime of 3 hours 40 minutes over the previous two weeks, and a p95 above 6 hours. I pulled the last 14 runs from the scheduler logs and confirmed the variance tracked database load, not input size. Invoice count had grown only 8% in that period.
Then I reproduced it. I restored a snapshot from the previous night, ran the export with a profiler on, and timed three stages separately: reading invoices, resolving tax rates, and writing the file. Reading took 4 minutes. Writing took 2 minutes. The tax lookup took the rest. That split mattered because my initial guess, that the file writing was slow, was wrong.
The code looked like this in outline:
# Before: one query per tenant
for tenant in tenants:
rate = db.query("SELECT rate FROM tax_rates WHERE tenant_id = %s", tenant.id)
row["tax_rate"] = rate
# After: one query for the whole batch, keyset paging for output
rates = db.query(
"SELECT tenant_id, rate FROM tax_rates WHERE tenant_id = ANY(%s)",
tenant_ids,
)
rate_by_tenant = {r.tenant_id: r.rate for r in rates}
last_id = 0
while True:
page = db.query(
"SELECT * FROM invoices WHERE id > %s ORDER BY id LIMIT 5000", last_id
)
if not page:
break
for row in page:
row["tax_rate"] = rate_by_tenant[row.tenant_id]
writer.writerow(row)
last_id = page[-1].idThe batched query also needed an index to avoid a sequential scan on a growing table. I added CREATE INDEX CONCURRENTLY idx_tax_rates_tenant ON tax_rates (tenant_id), which took about 9 minutes on the snapshot and required no downtime.
Verification and trade-offs
I compared output before and after on the same snapshot, row by row, including a checksum over the sorted file. The files matched exactly, which ruled out the risk that batching had changed ordering or dropped tenants with no tax rate. I also ran the export twice under load, with the application traffic replayed at roughly 60% of peak, to check it no longer degraded the main service.
| Metric | Before | After |
|---|---|---|
| Tax lookup queries | 48,000 | 1 |
| Median runtime | 3 h 40 min | 11 min |
| Peak memory during export | 6.8 GB | 410 MB |
| Output checksum | baseline | identical |
The trade-off I accepted was a slightly more complex export that now depends on the index existing. I added a startup check that fails fast if the index is missing, rather than silently falling back to the slow path. I also left the old per-tenant code path out entirely. Keeping both would have meant maintaining two behaviours for a case that no longer occurred.
If I had more time, the next step would be incremental exports, so only invoices changed since the last run are sent. I did not do that first because it would have added change-detection complexity before fixing a problem I could already measure and prove. The lesson I took from it is to time the stages before touching the code. The obvious suspect was not the slow part.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-15How would you handle a situation where your solution did not meet client expectations?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I treat it as a gap between the outcome the client expected and the outcome I measured, and I close that gap in the open. First I pin down exactly what was expected, in their words and in numbers if possible. Then I show them what I built against that same measure, including where it fell short. Only then do we decide whether to fix the build, change the scope, or reset the expectation with evidence. I do not start by defending the code or by quietly shipping more features.
A concrete case from a reporting tool I built for an operations team. The client expected a filtered export to finish in under 2 seconds. In their environment it took 9 seconds on 400,000 rows. My local test had used 20,000 rows and finished in 300 ms, so I had shipped against the wrong data volume.
What I did, in order
- Reproduce their number. I loaded a production-shaped extract, 400,000 rows, and confirmed 8.7 seconds. That turned a vague complaint into a shared fact.
- Diagnose before proposing. The query scanned the full table because the filter column had no index in their database. An index cut it to 1.1 seconds in my test. That is a fix, not a redesign.
- Put options in front of the client with trade-offs. Option A: add the index, 1 day of work, 1.1 seconds, small write cost on inserts. Option B: pre-aggregate nightly, 2 weeks, under 200 ms, but data is a day old. Option C: cap the export at 50,000 rows and paginate, 3 days, keeps it fast but changes the workflow.
- Agree a measurable acceptance test, then ship and verify with them. We picked A, and the acceptance test became: export of 400,000 rows completes in under 2 seconds on their hardware, run three times, median reported.
| Step | What I showed the client | Decision made |
|---|---|---|
| Day 0 | Their report: 9 seconds, expected under 2 | Agreed the measure and the dataset |
| Day 1 | My reproduction: 8.7 seconds on 400,000 rows | Confirmed it was missing index, not code logic |
| Day 2 | Three options with cost, latency and freshness | Client chose index, option A |
| Day 3 | Fix deployed to their staging environment | Ran the agreed test together |
| Day 4 | Median 1.1 seconds across three runs | Signed off, index added to migration checklist |
Where this goes wrong, and how I guard against it
The common failure is arguing about intent. "That is what you asked for" ends the conversation and the relationship. I avoid it by anchoring on the outcome they described, even if the written spec said something looser. If the spec and the expectation differ, I surface that difference explicitly and ask which one governs.
The second failure is fixing the wrong thing. If I had optimised the code without reproducing on their data volume, I would have burned a week and still missed 2 seconds. Reproduction first keeps the fix cheap and credible.
The third failure is a vague close. "Should be faster now" invites the same complaint next month. The acceptance test, run with the client watching, is what closes it. I also write the lesson into the place the next engineer will find it. In this case that was the migration checklist and the test data volume in the repo, so the next export feature gets tested at 400,000 rows from the start.
If the gap turns out to be scope rather than a defect, I say so plainly and re-negotiate scope against the original goal. Sometimes the right answer is to tell a client their expectation was based on a misunderstanding, but I only do that after I have shown them the numbers for both their expectation and my build. Evidence first, judgement second.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-16What factors do you consider when designing a scalable application?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I start by asking what "scale" means for this product, because the answer changes the design. Is it 10x traffic, 10x data, 10x tenants, or the same traffic with a team of two running it for ten years? At Constellation-style businesses, that last one is usually the real constraint. The system has to be operable by a small team, cheap to run, and boring to change.
So I design for five things in this order: stateless request handling, data access that does not degrade linearly, a clear bottleneck with a measured headroom number, failure isolation, and cost per unit of work. I do not start with microservices or a cache layer. I start with a single deployable that can be run as two or three copies behind a load balancer, and I prove where it breaks.
Stateless means sessions, uploads and background jobs do not live in process memory. If an instance dies mid-request, the next instance can finish the job from the database and object storage alone. That is what lets me add capacity by adding instances instead of migrating state.
Where it actually breaks
I put numbers on the bottleneck before I optimise anything. Hypothetical example, labelled as such: one app instance handles 400 requests per second at p99 120 ms against a Postgres primary. At 1,200 rps I need three instances, and the database becomes the limit long before the app does. If 80% of reads are point lookups on indexed keys, a read replica takes that traffic off the primary. If reads are aggregations over a growing table, a replica helps less and I need a precomputed summary or a different access path.
| Lever | What it fixes | What it costs | When I skip it |
|---|---|---|---|
| Horizontal app instances | CPU-bound request handling | Load balancer, health checks | Traffic under ~200 rps on one instance |
| Connection pooling | DB connection exhaustion | Pool tuning, timeouts | Single instance, low concurrency |
| Read replica | Read load on primary | Replication lag, routing code | Writes dominate, or lag breaks reads |
| Cache | Repeated expensive reads | Invalidation, stale data bugs | Data changes faster than it is read |
| Queue for async work | Slow side effects blocking requests | Worker fleet, retry and dead-letter handling | Work takes under ~100 ms |
| Partitioning or sharding | Single-table growth | Query complexity, rebalancing | One table passes a few hundred GB |
The table is the trade-off I would defend in the room. Each lever adds an operational surface a small team has to own at 2 a.m. A cache that saves 30 ms but serves stale invoices is a bad trade. A queue that turns a 2 s synchronous email send into a 202 with a job ID is usually a good one.
Failure modes I design for explicitly
Timeouts and retries come first. Every downstream call gets a deadline, and retries use exponential backoff with jitter and a cap, or a retry storm turns a slow database into a dead one. Idempotency keys on creates stop duplicate orders when a client retries. Backpressure matters too: if the queue grows past, say, 10,000 jobs, I shed low-priority work and alert, rather than letting memory grow until the worker is OOM-killed.
Data growth is the slow failure. I check index selectivity, pagination and query plans as tables grow. Keyset pagination instead of OFFSET keeps page 500 fast. A composite index on (tenant_id, created_at) keeps one tenant's history from scanning another tenant's rows. I also set retention and archival rules early, because deleting or archiving a 2 TB table later is a project, not a query.
Cost and longevity
For a long-lived product I prefer managed services with clear per-unit pricing over self-hosted infrastructure, and I avoid exotic dependencies that only one person understands. The arithmetic I show product is simple: at 1,200 rps sustained, three app instances plus a primary and one replica might cost a few hundred dollars a month on a mainstream cloud, while a prematurely sharded setup costs engineering time every week. That time is the real budget.
My closing line in an interview would be: I scale the bottleneck I have measured, keep the system runnable by a small team, and add complexity only when a number on a dashboard tells me to.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-17How would you find the longest substring without repeating characters in a string?
Reported in Constellation Software Software Engineer interview ...
Assume substring means contiguous, which is the usual reading, and that the input is a sequence of characters where equality is exact. Empty input returns length 0. I would use a sliding window with the last index of each character.
The 90-second answer
Keep a window [left, right] that contains no repeats. Extend right one character at a time. If the new character was seen inside the current window, move left to just after its previous occurrence. Otherwise keep left where it is. After adjusting, the window is valid again, so record its length if it beats the best so far. Each index enters and leaves the window once, so the scan is O(n) time and O(k) space for k distinct characters in the window.
# Python 3.12
def longest_unique(s: str) -> int:
last: dict[str, int] = {}
left = 0
best = 0
for right, ch in enumerate(s):
if ch in last and last[ch] >= left:
left = last[ch] + 1
last[ch] = right
best = max(best, right - left + 1)
return bestThe condition last[ch] >= left matters. A character seen before the window started should not pull left backwards. The alternative form left = max(left, last[ch] + 1) states the same rule and is harder to get wrong under pressure.
Trace on abca, where the answer is 3 (abc):
| right | ch | last[ch] before | left after | window | best |
|---|---|---|---|---|---|
| 0 | a | - | 0 | a | 1 |
| 1 | b | - | 0 | ab | 2 |
| 2 | c | - | 0 | abc | 3 |
| 3 | a | 0 | 1 | bca | 3 |
At right = 3, the previous a at index 0 sits inside the window, so left jumps to 1. The window becomes bca, still length 3, and the scan ends.
Why this beats the obvious alternatives:
| Approach | Time | Space | Problem |
|---|---|---|---|
| Brute force, check every substring | O(n^3) with slicing, O(n^2) with a set per start | O(n) | Re-scans the same characters repeatedly |
| Sliding window, hash map of last index | O(n) | O(k) | Needs a map; see failure modes below |
| Sliding window, fixed array of size 128 or 256 | O(n) | O(1) | Only works for ASCII or Latin-1, breaks on Unicode |
Failure modes I would name if asked to harden it:
- Off by one on
left. Settingleft = last[ch]instead oflast[ch] + 1keeps the duplicate in the window and inflates the answer on inputs likebbbbb. - Unicode granularity. Python iterates code points, so an emoji made of a base character plus a combining mark counts as two characters. If the caller means grapheme clusters, I would segment first (for example with a grapheme library) and run the same algorithm over the segments. For a coding interview, code points are the expected unit and I would say so.
- Very large inputs. The map holds one entry per distinct character, not per position, so memory stays bounded by alphabet size in practice. For a stream too large to hold, the same window logic works incrementally and only the map and two integers persist.
Edge cases to test before calling it done: "" gives 0, "bbbbb" gives 1, "pwwkew" gives 3 (wke), and "dvdf" gives 3 (vdf), which catches the stale-index bug because the second d at index 2 was last seen at index 0, already outside the window.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-18Explain how you would implement a binary search algorithm?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I would assume a sorted array with random access, and state that assumption first because binary search silently returns the wrong answer on unsorted input. The invariant I maintain is that the target, if present, lies in values[lo:hi], with hi exclusive. Each iteration halves that window, so the loop runs at most ceil(log2(n)) + 1 times.
# Python 3.11, iterative version, checked against sorted lists
def binary_search(values, target):
lo, hi = 0, len(values) # hi is exclusive
while lo < hi:
mid = lo + (hi - lo) // 2
if values[mid] < target:
lo = mid + 1
elif values[mid] > target:
hi = mid
else:
return mid
return -1Making hi exclusive removes the classic off-by-one. There is no hi = mid - 1 case to get wrong, and the loop ends when the window is empty. In Java, C or C++ I would also write mid as lo + (hi - lo) / 2 rather than (lo + hi) / 2, because the latter overflows when lo + hi exceeds the maximum integer, which matters for arrays near 2 billion elements.
Worked trace
Searching for 14 in [2, 5, 8, 11, 14, 19, 23]:
| Step | lo | hi | mid | values[mid] | Action |
|---|---|---|---|---|---|
| 1 | 0 | 7 | 3 | 11 | 11 < 14, so lo = 4 |
| 2 | 4 | 7 | 5 | 19 | 19 > 14, so hi = 5 |
| 3 | 4 | 5 | 4 | 14 | match, return 4 |
Three probes instead of up to seven for a linear scan. At scale the gap widens: 1,000,000 sorted records need at most 20 probes with binary search, against 500,000 on average for a linear scan. That is why I would use it for a sorted in-memory index, for example a product catalogue loaded into a service, rather than scanning a list per request.
Duplicates and insertion point
The version above returns any matching index, which is fine for a unique key. If duplicates exist and I need the first occurrence, I drop the equality branch and keep moving hi down:
def lower_bound(values, target):
lo, hi = 0, len(values)
while lo < hi:
mid = lo + (hi - lo) // 2
if values[mid] < target:
lo = mid + 1
else:
hi = mid
return lo # first index where values[i] >= target, or len(values)That also gives the insertion point that keeps the list sorted, which is what Python's bisect module exposes as bisect_left. In production I would usually call the standard library (bisect in Python, Arrays.binarySearch in Java, std::lower_bound in C++) instead of hand-rolling it, and keep the hand-written version for interviews or a constrained environment.
When I would not use it
| Approach | Cost | Use it when |
|---|---|---|
| Linear scan | O(n) | n is small, data is unsorted, or you need every match |
| Binary search | O(log n) | Sorted, random access, exact match |
| Hash map | O(1) average | Exact match on unsorted data and memory is available |
| Interpolation search | O(log log n) average | Sorted and values are roughly evenly distributed |
Binary search also fails in predictable ways. Unsorted input produces a plausible-looking -1 instead of an error, so I would validate sortedness at ingestion rather than per query. A bug where lo = mid instead of lo = mid + 1 loops forever on the same element. And if the data lives in a database, a B-tree index already performs this search, so the right move is an indexed query rather than pulling rows into memory and searching them in application code.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-19Can you demonstrate how to use a hash table for efficient data retrieval?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
A hash table maps a key to a bucket index with a hash function, then stores the entry there. Lookup hashes the key, jumps to that bucket, and compares keys until it finds a match. Average case is O(1) for insert, lookup, and delete, because the work does not grow with the number of entries. Worst case is O(n) when many keys collide into the same bucket or chain.
I would demo it on a lookup I actually ship: resolving tenant configuration by tenant ID in a request handler, before touching the database.
# Python 3.12. Dict is a CPython hash table: open addressing, insertion-ordered.
class TenantConfigCache:
def __init__(self) -> None:
self._table: dict[str, dict] = {}
self.hits = 0
self.misses = 0
def get(self, tenant_id: str) -> dict | None:
config = self._table.get(tenant_id) # hash, probe, compare key
if config is None:
self.misses += 1
return None
self.hits += 1
return config
def put(self, tenant_id: str, config: dict) -> None:
self._table[tenant_id] = config
cache = TenantConfigCache()
cache.put("t_acme", {"plan": "pro", "region": "eu-west"})
cache.get("t_acme") # hit, no DB round trip
cache.get("t_globex") # miss, caller falls back to the databaseThe point of the demo is the contract: the key is immutable, the hash is stable for the life of the process, and a miss is cheap. If the key can mutate after insertion, its hash changes and the entry becomes unreachable. That is the first bug I check for in review.
Worked trace
Assume capacity 8, hash = sum of bytes mod 8, linear probing on collision. Hypothetical figures, chosen to show the mechanics.
| Step | Operation | Hash | Bucket probed | Result |
|---|---|---|---|---|
| --- | --- | --- | --- | --- |
| 1 | put t_acme | 3 | 3 empty | stored at 3 |
| 2 | put t_initech | 3 | 3 occupied, 4 empty | stored at 4 |
| 3 | get t_acme | 3 | 3 key matches | hit, 1 probe |
| 4 | get t_initech | 3 | 3 mismatch, 4 matches | hit, 2 probes |
| 5 | get t_globex | 6 | 6 empty | miss, 1 probe |
Load factor decides when this stays fast. Load factor is entries divided by capacity. CPython and most production tables resize at about 0.66 to 0.75, doubling capacity and rehashing every entry. At 10,000 entries and capacity 16,384, load factor is 0.61 and probes stay near 1 to 2. Let it climb past 0.9 and probe lengths grow sharply, so p99 lookup latency climbs with them. I alert on load factor and on max probe or chain length, not just on hit rate.
When a hash table is the wrong tool
| Need | Better structure | Why |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
Range query, tenant_id between A and B | B-tree index in the database | Hash tables have no ordering |
| Sorted output, pagination by key | Sorted array or B-tree | Hash iteration order is arbitrary |
| Data larger than memory, shared across processes | Database index or Redis | An in-process table dies with the process and duplicates per instance |
| Exact lookup by ID, hot path, fits in memory | Hash table | O(1) average, one cache line in the common case |
Failure modes I name in the interview
Collision attacks: if keys are attacker controlled, as in a JSON body parsed into a hash map, a weak hash lets an attacker craft many keys colliding into one bucket and turn O(1) lookups into O(n). Python mitigates this with SipHash and a per-process random seed for strings. In Java, HashMap caps long bin chains and treeifies them past a threshold. If I write my own table, I use a seeded hash and I never expose raw hash values.
Unbounded growth: a cache keyed by user ID with no eviction grows until the process is OOM killed. I bound it with a max size, TTL, or an LRU policy, and I emit the size as a metric.
Stale reads: the table is fast and wrong after a config change. I invalidate on write, or version the value and check the version on read, and I keep the database as the source of truth.
For a product engineer the takeaway is practical: use the hash table for the hot exact-match path, keep the database for durability and range queries, and instrument load factor, probe length, hits, and misses so degradation shows up in a dashboard before it shows up as a slow request.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-20Describe the time complexity of your code solutions?
Reported in Constellation Software Software Engineer interview ...
The 90-second answer
I start by naming n, because complexity without it means nothing. For a list of customers, n is the number of customers. For a search, it can be the length of the string. Then I give the worst case, the average case when they differ, and the extra memory. I also say what dominates in practice, since a product endpoint usually spends more time waiting on a database or an HTTP call than on the loop itself.
Take a task I have shipped in an internal tool: find duplicate customer emails in a CSV import of up to 100,000 rows.
# Python 3.12
def find_duplicate_emails(customers):
seen = {}
duplicates = []
for customer in customers:
key = customer.email.lower()
if key in seen:
duplicates.append(customer.id)
else:
seen[key] = customer.id
return duplicatesThat is O(n) average time and O(n) space. Each row does one hash lookup and one insert. The worst case is worse if many keys collide in the hash table, which in CPython is rare for email strings but is the honest bound to state. The naive version, comparing every row against every earlier row, is O(n^2) time and O(1) extra space.
The difference is not academic at import size:
| Approach | Operations at n = 100,000 | Rough time at 10^8 simple ops/sec |
|---|---|---|
| Nested comparison | n(n-1)/2 = ~5 x 10^9 comparisons | ~50 seconds |
| Hash map, as above | ~100,000 lookups plus inserts | a few milliseconds of CPU, plus file I/O |
| Sort then scan | n log n = ~1.7 x 10^6 comparisons | well under a second |
Sorting wins on memory if the file is too large for a map, and it gives duplicates in sorted order for free. I would pick the map when the import fits in memory and I need the answer in one pass, and sorting when memory is the constraint or the caller already needs sorted output.
How I talk about it in a review
I write the bound next to the code, with the assumption that makes it true. Something like: O(n) time, O(n) space, n = rows in import file, assumes file fits in memory. That forces a second look at the places where the bound breaks. A loop that looks O(n) becomes O(n x m) when the body calls an API per row, where m is the response time. At 10,000 rows and 80 ms per call, that is 800 seconds of wall clock even though the loop is linear. The fix is batching or a single query, and the complexity statement should include the I/O term so nobody is surprised.
Three other traps come up often. First, n is not always the collection size. Searching a string of length m inside n documents is O(n x m) with a naive match, which is why substring search needs its own analysis. Second, early exit changes the average case. A linear scan that finds the target on row 3 is fast in practice, but the worst case is still O(n) and that is what a timeout budget has to survive. Third, constants matter at small n. For a 40 row configuration list, an O(n^2) loop is 1,600 iterations and clearer to read than a hash map with extra bookkeeping. I would not add complexity to save microseconds nobody can measure.
What I would say if pushed
If an interviewer asks for a tighter bound, I separate CPU work from waiting. CPU work is the loop count. Wall clock is CPU plus I/O, and I give both. If they ask about space, I count the map, the output list, and any copy of the input, since a sorted(customers) call quietly allocates a second list. If they ask when I would accept O(n^2), I point to a hard cap on input size, enforced in code, plus a test at that cap. Without the cap, O(n^2) is a latency incident waiting for a larger file.
My habit is to put the bound, the definition of n, and the cap in the pull request description. It takes one line and it makes the trade-off reviewable before the code reaches production.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Curated: · Written: · Reviewed: