# most common hubspot coding interview questions

## the 15 most asked questions in a hubspot interview

### Arrays

Sum of two values

#### â€‹

Problem Statement

â€‹

Given an array of integers and a value, determine if there are any two integers in the array whose sum is equal to the given value.

â€‹

Move zeros to the left

#### â€‹

Problem Statement

â€‹

Move all zeros to the left of an array while maintaining its order.

â€‹

### linked lists

Delete node with given key

#### â€‹

Problem statement

â€‹

You are given the head of a linked list and a key. You have to delete the node that contains this given key.

â€‹

Copy linked list with arbitrary pointer

#### â€‹

Problem statement

â€‹

You are given a linked list where the node has two pointers. The first is the regular ‘next’ pointer. The second pointer is called ‘arbitrary_pointer’ and it can point to any node in the linked list.

Your job is to write code to make a deep copy of the given linked list. Here, deep copy means that any operations on the original list (inserting, modifying and removing) should not affect the copied list.

â€‹

### trees

Mirror binary trees

#### â€‹

Problem statement

â€‹

Given the root node of a binary tree, swap the 'left' and 'right' children for each node.

â€‹

Check if two binary trees are identical

#### â€‹

Problem statement

â€‹

Given the roots of two binary trees, determine if these trees are identical or not.

â€‹

### strings

String segmentation

#### â€‹

Problem statement

â€‹

Given a dictionary of words and an input string tell whether the input string can be completely segmented into dictionary words.

â€‹

Find all palindrome substrings

#### â€‹

Problem statement

â€‹

Given a string find all non-single letter substrings that are palindromes.

â€‹

### dynamic programming

Largest sum subarray

#### â€‹

Problem statement

â€‹

Given an array, find the contiguous subarray with the largest sum.

â€‹

### Math and stats

Determine if the number is valid

#### â€‹

Problem statement

â€‹

Given an input string, determine if it makes a valid number or not. For simplicity, assume that white spaces are not present in the input.

â€‹

### backtracking

Print balanced brace combinations

Problem statement

â€‹

Print all braces combinations for a given value 'N' so that they are balanced.

â€‹

### Graphs

Minimum spanning tree

#### â€‹

Problem statement

â€‹

Find the minimum spanning tree of a connected, undirected graph with weighted edges.

â€‹

### design

Implement a LRU cache

#### â€‹

Problem statement

â€‹

Least Recently Used (LRU) is a common caching strategy. It defines the policy to evict elements from the cache to make room for new elements when the cache is full, meaning it discards the least recently used items first.

â€‹

### sorting and searching

Find the high and low index

#### â€‹

Problem statement

â€‹

Given a sorted array of integers, return the low and high index of the given key. Return -1 if not found. The array length can be in the millions with many duplicates.

â€‹

Merge overlapping intervals

#### â€‹

Problem statement

â€‹

You are given an array (list) of interval pairs as input where each interval has a start and end timestamp. The input array is sorted by starting timestamps. You are required to merge overlapping intervals and return output array (list).

â€‹

### more interview prep?

We've partnered with Educative to bring you the best interview prep around. For more data structure and algorithm practice, check out the link below.

Need help preparing for the interview?

â€‹

Check out the Definitive Interview Prep Roadmap,

written and reviewed by real hiring managers.