HubSpot logo

HubSpot Hard Interview Questions

7 hard-level practice questions for HubSpot technical interviews

HubSpot software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Hard Verified Question #1

1. OA[CodeSignal] Cloud File Storage System


Category: Graph coding problem

Question Your task is to implement a simple in-memory cloud storage system that maps objects (files) to their metadata (name, size, etc.). You...

Input: Graph (nodes and edges)
Output: Array
Want to practise this one?
Create a free account to open the full question and practise HubSpot questions with AI.
Sign up free
coding Hard Verified Question #2

2. OA[CodeSignal] Design Banking System


Category: Graph coding problem

Question Design a banking system that supports account management, transactions, and various financial operations.

Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #3

3. OA[CodeSignal] In-Memory Database


Category: Graph coding problem

Description Implement a simplified in-memory database that supports record manipulation with various operations. The system should handle basic...

Input: Graph (nodes and edges)
Output: Array
coding Hard Verified Question #4

4. Event Participant Role Validator


Category: Trie-based coding problem

Question A conference platform manages associations between events, attendees, and their roles. Each association is represented by three strings:...

Input: List
Output: Array
coding Hard Verified Question #5

5. Peak Stream Viewer Tracker


Category: String coding problem

Question A streaming analytics platform needs to track peak viewership for each user on each day. You are given a list of Session records. Each...

Input: List
Output: Computed result
coding Hard hash map #1

1. [AI Enabled Coding] Calling Concurrency Billing


Scenario
HubSpot's calling tools produce call records that a billing service must transform into daily customer usage. Finance needs auditable peak-concurrency results, while administrators also need to detect customer and shared-team capacity overruns. You may use an AI assistant while implementing this assessment; explain and verify its suggestions.
Part 1 — Daily customer peaks
  • Each input record has string fields customerId, teamId, callId, startTimestamp, and endTimestamp. Timestamps are decimal strings representing Unix milliseconds.

  • Calls occupy half-open intervals [startTimestamp, endTimestamp): a call ending at a timestamp does not overlap one starting then.

  • Split calls at UTC midnight. Each UTC day contains exactly 86400000 milliseconds. A call ending exactly at midnight contributes nothing to the following day.

  • For each customer and UTC date with positive-duration usage, return customerId, date, maxConcurrentCalls, the earliest timestamp attaining that maximum, and all callIds active at that timestamp.

  • Sort results by customerId lexicographically, then date. Sort each callIds list lexicographically. Output timestamps and counts are JSON integers.

  • Do not iterate over individual milliseconds. The return type is up to you; the examples show the required logical content.


Function signature: summarize_calls(calls: list[dict[str, str]]) -> candidate_chosen_type
Example 1:
Input:
{
  "calls": [
    {"customerId":"A","teamId":"T","callId":"a","startTimestamp":"1000","endTimestamp":"5000"},
    {"customerId":"A","teamId":"T","callId":"b","startTimestamp":"3000","endTimestamp":"7000"},
    {"customerId":"A","teamId":"T","callId":"c","startTimestamp":"5000","endTimestamp":"9000"},
    {"customerId":"B","teamId":"U","callId":"d","startTimestamp":"86398000","endTimestamp":"86402000"},
    {"customerId":"B","teamId":"U","callId":"e","startTimestamp":"86400000","endTimestamp":"86403000"}
  ]
}

Output:
[
  {"customerId":"A","date":"1970-01-01","maxConcurrentCalls":2,"timestamp":3000,"callIds":["a","b"]},
  {"customerId":"B","date":"1970-01-01","maxConcurrentCalls":1,"timestamp":86398000,"callIds":["d"]},
  {"customerId":"B","date":"1970-01-02","maxConcurrentCalls":2,"timestamp":86400000,"callIds":["d","e"]}
]

Explanation: Customer A first reaches two calls at 3000. At 5000, a ends as c starts, so concurrency remains two rather than becoming three. Call d contributes to both dates; e contributes only to January 2.
Part 2 — Extensible capacity policies
Administrators now supply another list of string-valued maps: policies with scope, scopeId, and maxConcurrentCalls. Support customer scope, matching customerId, and team scope, matching teamId across all customers. Each record belongs to exactly one customer and one team, and a call may count toward both policies independently.
Discuss how the return type changes before implementing this extension. Preserve the Part 1 results under customers and add policyResults. Your approach must be flexible enough to support additional policies and future scope kinds without rewriting the interval-processing algorithm.
For every policy and date with matching positive-duration usage, emit:
  • scope, scopeId, date, and integer limit from the policy.

  • maxConcurrentCalls, earliest peak timestamp, and sorted peak callIds, using Part 1 semantics.

  • overLimitMillis: total duration during which the scope's concurrency is strictly greater than its limit.

  • excessCallMillis: the sum, over all constant-concurrency intervals, of max(0, concurrency - limit) * intervalDurationMillis.


Include policy-day results even when both overage fields are zero. Omit policy-days with no matching calls. Sort policy results by scope lexicographically, then scopeId lexicographically, then date. There is at most one policy for each (scope, scopeId) pair. Part 1 summaries remain present even for customers with no policy.
Function signature: evaluate_billing(calls: list[dict[str, str]], policies: list[dict[str, str]]) -> candidate_chosen_type
Example 2:
Input:
{
  "calls": [
    {"customerId":"A","teamId":"T","callId":"a","startTimestamp":"1000","endTimestamp":"5000"},
    {"customerId":"A","teamId":"T","callId":"b","startTimestamp":"3000","endTimestamp":"7000"},
    {"customerId":"B","teamId":"T","callId":"c","startTimestamp":"4000","endTimestamp":"6000"},
    {"customerId":"B","teamId":"T","callId":"d","startTimestamp":"6000","endTimestamp":"8000"}
  ],
  "policies": [
    {"scope":"customer","scopeId":"A","maxConcurrentCalls":"1"},
    {"scope":"team","scopeId":"T","maxConcurrentCalls":"2"}
  ]
}

Output:
{
  "customers": [
    {"customerId":"A","date":"1970-01-01","maxConcurrentCalls":2,"timestamp":3000,"callIds":["a","b"]},
    {"customerId":"B","date":"1970-01-01","maxConcurrentCalls":1,"timestamp":4000,"callIds":["c"]}
  ],
  "policyResults": [
    {"scope":"customer","scopeId":"A","date":"1970-01-01","limit":1,"maxConcurrentCalls":2,"timestamp":3000,"callIds":["a","b"],"overLimitMillis":2000,"excessCallMillis":2000},
    {"scope":"team","scopeId":"T","date":"1970-01-01","limit":2,"maxConcurrentCalls":3,"timestamp":4000,"callIds":["a","b","c"],"overLimitMillis":1000,"excessCallMillis":1000}
  ]
}

Explanation: A exceeds its limit on [3000,5000), giving 2000 over-limit milliseconds and (2-1)*2000 = 2000 excess-call milliseconds. Team T exceeds its limit only on [4000,5000), giving 1000 and (3-2)*1000 = 1000, respectively. At 6000, c ends and d starts; this does not create an additional peak or overage.
Example 3:
Input:
{
  "calls": [
    {"customerId":"A","teamId":"T","callId":"a","startTimestamp":"86399000","endTimestamp":"86402000"},
    {"customerId":"A","teamId":"T","callId":"b","startTimestamp":"86400000","endTimestamp":"86402000"},
    {"customerId":"A","teamId":"T","callId":"c","startTimestamp":"86400000","endTimestamp":"86401000"},
    {"customerId":"B","teamId":"T","callId":"d","startTimestamp":"86402000","endTimestamp":"86403000"}
  ],
  "policies": [
    {"scope":"customer","scopeId":"A","maxConcurrentCalls":"1"},
    {"scope":"team","scopeId":"T","maxConcurrentCalls":"1"}
  ]
}

Output:
{
  "customers": [
    {"customerId":"A","date":"1970-01-01","maxConcurrentCalls":1,"timestamp":86399000,"callIds":["a"]},
    {"customerId":"A","date":"1970-01-02","maxConcurrentCalls":3,"timestamp":86400000,"callIds":["a","b","c"]},
    {"customerId":"B","date":"1970-01-02","maxConcurrentCalls":1,"timestamp":86402000,"callIds":["d"]}
  ],
  "policyResults": [
    {"scope":"customer","scopeId":"A","date":"1970-01-01","limit":1,"maxConcurrentCalls":1,"timestamp":86399000,"callIds":["a"],"overLimitMillis":0,"excessCallMillis":0},
    {"scope":"customer","scopeId":"A","date":"1970-01-02","limit":1,"maxConcurrentCalls":3,"timestamp":86400000,"callIds":["a","b","c"],"overLimitMillis":2000,"excessCallMillis":3000},
    {"scope":"team","scopeId":"T","date":"1970-01-01","limit":1,"maxConcurrentCalls":1,"timestamp":86399000,"callIds":["a"],"overLimitMillis":0,"excessCallMillis":0},
    {"scope":"team","scopeId":"T","date":"1970-01-02","limit":1,"maxConcurrentCalls":3,"timestamp":86400000,"callIds":["a","b","c"],"overLimitMillis":2000,"excessCallMillis":3000}
  ]
}

Explanation: January 1 has one call and no overage. On January 2, both policies independently see concurrency three for 1000 milliseconds and two for another 1000: over-limit duration is 2000, while excess-call duration is (3-1)*1000 + (2-1)*1000 = 3000. Call c contributes to both policies simultaneously. At 86402000, A's remaining calls end before d is counted, so team concurrency becomes one and the overage stops.
Notes:
  • There are at most 100000 calls and 100000 policies; call IDs are globally unique, IDs are nonempty, and inputs may be unsorted. Policy limits are integers from 0 through 100000.

  • Timestamps are valid nonnegative Unix milliseconds before year 2100; startTimestamp < endTimestamp, and each call lasts at most seven days. Epoch-era timestamps in the examples are synthetic fixtures.

  • Inputs are already fetched and valid. Networking, retries, and persistence are outside scope; use exact integer arithmetic.
Want to practise this one?
Create a free account to open the full question and practise HubSpot questions with AI.
Sign up free
system design Hard tree #2

2. Design MarketingAssetLibrary — manage campaign assets with hierarchical storage quotas


Background
HubSpot's Marketing Hub lets marketers work with files used in landing pages, emails, and campaigns. Model an in-memory asset library where campaign folders organize these files and enforce storage budgets. This exercise adapts the progressively extended file-system implementation reported by a HubSpot interview candidate; the quota rules below are exercise-specific, not claims about HubSpot's actual implementation.
Requirements
1. Initialize one folder with ID root and unlimited quota. Files and folders share a global ID namespace. Every non-root item has exactly one parent folder. IDs must be unique among live items; deleting an item permits its ID to be reused.
2. Support creating empty folders and uploading new files. File sizes must be positive integer byte counts. A folder's usage is the sum of the sizes of all files in its entire subtree. A quota of -1 means unlimited; otherwise usage must not exceed the quota, including a quota of zero.
3. Every mutation must be atomic: if it would violate any requirement, return false and change nothing. Invalid operations include missing IDs, a non-folder destination, duplicate IDs on creation, nonpositive file sizes, and quotas below -1. Lowering a quota below current usage fails.
4. Moving an item preserves its ID, contents, and quota. Reject moving root, moving a folder into itself or a descendant, and any move that exceeds a destination ancestor's quota. Moving an item to its existing parent succeeds as a no-op. Common ancestors must be checked against the net change, not a temporary copy of the moved bytes.
5. Deleting an item recursively removes its descendants and releases their storage from all surviving ancestors. Deleting root or a missing item fails. Querying usage returns -1 for a missing ID or a file ID.
6. Maintain cached subtree usage so usage queries are constant-time. Uploads, quota updates, and moves must not scan every file in an affected subtree. Recursive deletion may visit the items being removed.
Class API
  • MarketingAssetLibrary() — initialize the empty library.

  • create_folder(folder_id: str, parent_id: str, quota: int = -1) -> bool — create an empty folder under an existing folder.

  • upload(file_id: str, parent_id: str, size: int) -> bool — create a new file; overwriting an existing ID is not supported.

  • move(item_id: str, destination_id: str) -> bool — move an existing file or folder into a folder.

  • set_quota(folder_id: str, quota: int) -> bool — change a folder's quota, including the root quota.

  • delete(item_id: str) -> bool — recursively delete a non-root item.

  • usage(folder_id: str) -> int — return subtree file bytes, or -1 for an invalid folder ID.


Example 1:
Input sequence, starting with a new library:
[
  ["set_quota", "root", 60],
  ["create_folder", "drafts", "root", 50],
  ["create_folder", "published", "root", 40],
  ["upload", "hero-image", "drafts", 40],
  ["move", "hero-image", "published"],
  ["usage", "root"],
  ["usage", "drafts"],
  ["usage", "published"],
  ["upload", "email-banner", "drafts", 25],
  ["set_quota", "published", 30],
  ["usage", "root"]
]

Output:
[true, true, true, true, true, 40, 0, 40, false, false, 40]

Explanation: Moving the 40-byte image subtracts 40 from drafts and adds 40 to published; the root's net change is zero. Uploading the banner would make root usage 40 + 25 = 65, exceeding 60, so nothing is created. Reducing published to 30 fails because its usage is 40.
Example 2:
Input sequence, starting with a new library:
[
  ["create_folder", "campaign", "root", 100],
  ["create_folder", "email", "campaign", 30],
  ["upload", "logo", "email", 20],
  ["move", "campaign", "email"],
  ["move", "email", "campaign"],
  ["delete", "campaign"],
  ["usage", "root"],
  ["usage", "email"],
  ["upload", "logo", "root", 7],
  ["usage", "logo"],
  ["usage", "root"]
]

Output:
[true, true, true, false, true, true, 0, -1, true, -1, 7]

Explanation: Moving campaign into its descendant would create a cycle and fails. Moving email to its current parent succeeds without changes. Deleting campaign removes both folders and the 20-byte file, freeing the ID logo for reuse.
Constraints:
  • At most 10,000 live items, including root, and 10,000 method calls per instance.

  • IDs are nonempty, case-sensitive strings of at most 100 characters. Arguments have the declared types.

  • Positive file sizes and nonnegative quotas are at most 10^12 bytes; accumulated usage may exceed this value in unlimited folders. Nonpositive sizes and quotas below -1 must be rejected.

  • Calls are single-threaded. Persistence, file contents, permissions, and network access are out of scope.

  • Folder depth may be linear in the number of items; avoid relying on the language's recursion limit.

Start practicing HubSpot questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free