← Questions

Checksums, feature rollouts and dependency debugging

0
GoogleCodingLast asked Apr 2026

A coding interview question asked in Google's HackerRank assessment, last asked Apr 2026. It tests checksums, debugging and online assessment.

A 90-minute online assessment with two tasks. An AI coding assistant may be available for some of it, but the code you submit must pass the given unit tests. The second task starts from existing code with bugs: debugging the dependency handling is part of the work.

Part 1: email verification string

Weights: a = 1, b = 2, ..., z = 26, ':' = 27, '/' = 28, '.' = 29. Scan email from left to right in chunks of k characters (the last chunk may be shorter). For each chunk, sum the weights, take index = sum % len(verification), and append verification[index].

Unless you agree on a different interface with the interviewer, assume:

  • build_verification(email: str, verification: str, k: int) -> str
build_verification("abcde", "wxyz", 2)  ->  "zzx"   # sums 3, 7, 5 -> indices 3, 3, 1
build_verification("a:/.", "pqrs", 2)   ->  "pq"    # sums 28, 57 -> indices 0, 1
build_verification("", "ab", 3)         ->  ""

Part 2: feature rollout with dependencies

Decide whether a user gets target_feature. The user has a country, a platform (android or ios), a version and a set of enabled features. The rule has allowed countries and a minimum version per platform. You also get rollout_features (the features shipping in this batch) and dependency lines like "checkout: login, payments".

  • evaluate(user, rule, target_feature, rollout_features, dependency_lines) -> tuple[bool, str]

Checks, in this order:

  1. Country not allowed and platform version too low: (False, "COUNTRY_AND_PLATFORM_NOT_ALLOWED").
  2. Country not allowed: (False, "COUNTRY_NOT_ALLOWED: <country>").
  3. Version too low: (False, "ANDROID_VERSION_TOO_LOW") or (False, "IOS_VERSION_TOO_LOW").
  4. Only if 1–3 pass, check dependencies. A dependency is satisfied if it is already enabled for the user, or it is in rollout_features and its own dependencies are satisfied. Otherwise (False, "MISSING_DEPENDENCY: <feature>"). A cycle on the current path gives (False, "CYCLE: A -> B -> ... -> A"), starting at the first repeated feature.
  5. Otherwise (True, "ENABLED").

Parsing: trim spaces around names, split several dependencies into separate names, and accept empty lists ("login:").

user US/android/12, enabled {login}; allowed {US, CA}, min android 10, min ios 14
evaluate(..., "checkout", {checkout, payments}, ["checkout: login, payments", "payments:   "])
  ->  (True, "ENABLED")

user US/ios/16, enabled {}; allowed {US}, min ios 15
evaluate(..., "checkout", {checkout}, ["checkout: login"])
  ->  (False, "MISSING_DEPENDENCY: login")

evaluate(..., "a", {a, b, c, d}, ["a: b", "b: c", "c: d", "d: b"])
  ->  (False, "CYCLE: b -> c -> d -> b")

Clarifying questions

  • Which reason wins when both country and platform fail? (The combined one.)
  • Should dependencies of an already-enabled feature be checked again?
  • Must the existing sets of allowed countries and platforms be used, rather than hard-coded values?

What a strong answer covers

  • Part 1: a weight table, stepping in strides of k, an empty email.
  • Part 2: the check order exactly as specified, with no dependency lookups when eligibility fails.
  • Finding the parser bug: "login, payments" read as one name instead of two.
  • DFS with the current path and a map from feature to its position in the path, so the cycle message lists exactly the features on the cycle; a memo of features already known to be satisfiable.
  • Using the AI assistant well: reading what it produces and checking it against the tests.

Follow-ups

  • Report every missing dependency, not only the first.
  • Percentage rollouts: enable for a stable 10% of users by hashing the user id.
  • Dependencies with minimum versions.

Where it's asked

  • Google · HackerRank assessment · Last asked Apr 202690 min · Two problems on HackerRank · Some early-career assessments enable the built-in assistant; others forbid AI. The invitation says which.

What it tests

checksums · debugging · online assessment

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding