CodeSignal OAs logo

CodeSignal OAs Medium Interview Questions

30 medium-level practice questions for CodeSignal OAs technical interviews

CodeSignal OAs 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 Medium Verified Question #1

1. OA[CodeSignal] Find Effective Communication Channels


Category: String coding problem
You are given billing records, communication logs, and payment records for a healthcare system. Your task is to determine which communication channel...
Input: String
Output: Computed result
coding Medium Verified Question #2

2. OA [CodeSignal] Final Prices After Discount


Category: Array coding problem
You are given an array prices where prices[i] is the price of an item. For each item at index i, find the first item at index j > i such that...
Input: Array
Output: Computed result
coding Medium Verified Question #3

3. OA [CodeSignal] Jump Game


Category: Array coding problem
You are at position i in an array. From each position, you can jump to: - i + 1 (one step forward) - Any position i + k where k ends in digit...
Input: Array
Output: Computed result
coding Medium Verified Question #4

4. OA [CodeSignal] Longest Subsequence With Limited Sum


Category: Array coding problem
You are given two arrays: nums (containing positive integers) and queries (each containing a target sum). For each query, return the maximum...
Input: Array
Output:** Computed result
coding Medium Verified Question #5

5. OA [CodeSignal] Minimum Operation To Reduce n To 0


Category: Algorithm coding problem
Given a positive integer n, in one operation you may replace n with either: - n = n + 2^i, or - n = n - 2^i for any integer i >= 0. Find...
Input: Integer(s)
Output: Integer
coding Medium Verified Question #6

6. OA [CodeSignal] Shortest Good Subarray


Category: Array coding problem
Given an array arr and an integer k, a subarray is called good if it contains at least k distinct integers. Return the length of the...
Input: Array
Output: Integer
coding Medium Verified Question #7

7. [CodeSignal] Maximum Zero-Sum Triplets


Category: Array coding problem

Question You are given an array A of integers. A triplet is a sequence of three consecutive elements. A triplet is called zero-sum if the...

Input: Array
Output: Computed result
coding Medium Verified Question #8

8. [CodeSignal] Warehouse Robot Commands


Category: Matrix coding problem

Question In a highly automated warehouse, a robot organizes packages stored in a rectangular grid. The grid is represented as a 2D list of integers...

Input: Matrix (2D array)
Output: Computed result
coding Medium Verified Question #9

9. [CodeSignal] Drone Hub Travel


Category: Array coding problem
Amazon is expanding its next-generation drone delivery network, consisting of m hubs arranged in a circular ring (Hub 1 is adjacent to Hub m)....
Input: Array
Output: Computed result
coding Medium Verified Question #10

10. [CodeSignal] Minimum Security Groups


Category: Array coding problem
A financial services company has requested AWS for a private deployment of its cloud network. There are n servers in the network where the security...
Input: Array
Output: Integer
coding Medium Verified Question #11

11. [CodeSignal] Maximum Secure Deliveries


Category: Array coding problem
You are given an array deliveryLogs of size n, where each element represents the number of parts delivered in the i-th log. You are also given...
Input: Array
Output: Integer
coding Medium Verified Question #12

12. Service Log Aggregator


Category: Trie-based coding problem
A distributed system emits log entries from multiple services and worker threads. Each log entry is a colon-separated string in the format...
Input: Array
Output: Computed result
coding Medium Verified Question #13

13. OA [CodeSignal] Workspace Tracker


Category: Interval-based coding problem
Build a system to track desk workers at a shared office space. The system records when each worker enters and leaves and computes how long they have...
Input: String
Output: Array
coding Medium Verified Question #14

14. [CodeSignal] Minimum Score Suppressor


Category: Algorithm coding problem
You are given a list of ad budgets (integers) and an integer k representing the number of throttle operations available. Each operation selects...
Input: List
Output: Integer
coding Medium Verified Question #15

15. [CodeSignal] Optimal Voucher Allocation


Category: Algorithm coding problem
You are given couponsCount discount coupons and a list of monthly service fees. Each coupon halves one service fee using integer floor division....
Input: List
Output: Integer
coding Medium Verified Question #16

16. OA [CodeSignal] Prime Jumps


Category: Algorithm coding problem

OA [CodeSignal] Prime Jumps A game is played with the following rules: - A player starts at cell 0 with a score of 0. - There is a row of n cells...

Input: Number(s)
Output: Computed result
coding Medium Verified Question #17

17. [CodeSignal] Common Free Slot


Category: Interval-based coding problem

[CodeSignal] Common Free Slot

Input: List
Output: Computed result
coding Medium Verified Question #18

18. [CodeSignal] Contact Role Capacity Validator


Category: String coding problem
A platform tracks permission assignments between departments, employees, and their access levels. Each assignment is represented by three strings:...
Input: List
Output: Array
coding Medium Verified Question #19

19. [CodeSignal] Country Meeting Date Finder


Category: Algorithm coding problem
A global organization is scheduling regional check-ins for its distributed teams. Each team member belongs to a region and provides a list of...
Input: List
Output: Array
coding Medium Verified Question #20

20. [CodeSignal] Customer Peak Call Tracker


Category: String coding problem
A billing platform tracks user sessions for resource usage metering. Each session record contains: - userId: an integer identifying the user. -...
Input: List
Output: Computed result
coding Medium Verified Question #21

21. [CodeSignal] Portfolio Path Counter


Category: Algorithm coding problem
A warehouse manager starts with initial units of inventory. In one operation, the manager can either restock one unit (increase inventory by 1) or...
Input: Number(s)
Output: Integer
coding Medium Verified Question #22

22. [CodeSignal] Leftmost Zero Filler


Category: Array coding problem
You are given a binary array slots containing only 0s and 1s, and an array of string commands ops. Apply each command in order: - Command "1": Find...
Input: Array of strings
Output: Computed result
coding Medium Verified Question #23

23. [CodeSignal] Matrix Command Engine


Category: Matrix coding problem
You are given a 2D integer array grid of size n x m and an array of strings commands. Apply each command in order: - "reverseRow r": Reverse the...
Input: Matrix (2D array)
Output: Computed result
coding Medium Verified Question #24

24. [CodeSignal] Sequential House Builder


Category: Grid/matrix coding problem
You are monitoring cell activations on an infinite integer grid line. Initially, no cells are active. You are given an array queries of distinct...
Input: 2D grid
Output: Integer
coding Medium dynamic programming #1

1. Dynamic Programming — Maximum Subarray Sum

Background: CodeSignal OAs is focused on optimizing coding challenges. Understanding how to maximize subarray sums is crucial for building efficient algorithms that assess code performance and data handling in real-time.
Problem statement: You are given an array of integers nums. Find the contiguous subarray (contiguous elements of the array) with the largest sum and return its sum.
Function/class signature:
  • def max_subarray_sum(nums: List[int]) -> int:

Example 1:
  • Input: nums = [-2,1,-3,4,-1,2,1,-5,4]

  • Output: 6

  • Explanation: The contiguous subarray [4,-1,2,1] has the largest sum = 6.

Example 2:
  • Input: nums = [1]

  • Output: 1

  • Explanation: The largest subarray is [1].

Constraints:
  • The input array has at least 1 element.

  • Each element in the array is an integer within the range [-10^4, 10^4].
coding Medium dynamic programming #2

2. [Array Manipulation] — Finding the Longest Increasing Subsequence

Background: CodeSignal OAs often deals with algorithm-intensive problems for candidates assessing their programming skills. One common problem type relates to identifying patterns in data sequences, particularly in arrays and lists.
Problem statement: Given an array of integers nums, find the length of the longest strictly increasing subsequence. A subsequence is defined as a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
Function/class signature:
  • def lengthOfLIS(nums: List[int]) -> int:

Example 1:
  • Input: nums = [10, 9, 2, 5, 3, 7, 101, 18]

  • Output: 4

  • Explanation: The longest increasing subsequence is [2, 3, 7, 101], which has length 4.

Example 2:
  • Input: nums = [0, 1, 0, 3, 2, 3]

  • Output: 4

  • Explanation: The longest increasing subsequence is [0, 1, 2, 3], which also has length 4.

Constraints:
  • 1 <= nums.length <= 2500

  • -10^4 <= nums[i] <= 10^4


coding Medium dynamic programming #3

3. Dynamic Programming — Longest Increasing Subsequence

Background: CodeSignal OAs requires efficient algorithms to handle a variety of competitive programming challenges and assessments that involve sequences. The longest increasing subsequence problem is a classic algorithmic challenge that can arise in numerous coding tests.
Problem statement: Given an array of integers nums, you need to return the length of the longest increasing subsequence. An increasing subsequence is a subset of numbers such that all elements are in increasing order. Your solution should be efficient enough to handle large input sizes.
Function/class signature:
  • def lengthOfLIS(nums: List[int]) -> int:

Example 1:
  • Input: nums = [10, 9, 2, 5, 3, 7, 101, 18]

  • Output: 4

  • Explanation: The longest increasing subsequence is [2, 3, 7, 101], thus the length is 4.

Example 2:
  • Input: nums = [0, 1, 0, 3, 2, 3]

  • Output: 4

  • Explanation: The longest increasing subsequence is [0, 1, 2, 3], thus the length is 4.

Constraints:
  • 1 <= nums.length <= 2500

  • -10^4 <= nums[i] <= 10^4
coding Medium hash map #4

4. Hash Map — Implement a word frequency counter

Background: In text processing and analytics, accurate counting of word occurrences is critical for generating insights. CodeSignal needs a reliable function to count the frequency of words in a given text, which can help in developing features related to data analysis on their platform.
Problem statement: Write a function that takes a string text and returns a dictionary where each key is a word from text and the value is the number of times that word appears. The words are case-insensitive and should be stripped of punctuation.
Function/class signature:
  • def word_frequency(text: str) -> Dict[str, int]:

Example 1:
  • Input: "Hello world! Hello everyone."

  • Output: {'hello': 2, 'world': 1, 'everyone': 1}

  • Explanation: The word hello appears twice (case-insensitive) while world and everyone appear once each.

Example 2:
  • Input: "CodeSignal is amazing! CodeSignal is the future..."

  • Output: {'codesignal': 2, 'is': 2, 'amazing': 1, 'the': 1, 'future': 1}

Constraints:
  • Length of text (1 ≤ len(text) ≤ 10^4)

  • The text contains alphanumeric characters and typical punctuation marks.

  • Return the frequency of each unique word in a case-insensitive manner.
coding Medium graph #5

5. Graph — Pathfinding in a Social Network

Background: CodeSignal OAs provides a platform for connecting educators and learners, making social interaction essential in its design. Efficient networking algorithms are crucial for ensuring smooth connectivity between users.
Problem statement: Given a graph representing a social network where each node is a user and edges represent relationships, implement a function that finds the shortest path between two users. The graph can be traversed in both directions. Use the user_id as the node identifier.
Function/class signature:
  • def shortest_path(graph: Dict[int, List[int]], start_id: int, end_id: int) -> List[int]:


Example 1:
Input: graph = {1: [2, 3], 2: [1, 4], 3: [1, 4], 4: [2, 3]}, start_id = 1, end_id = 4
Output: [1, 2, 4]
Explanation: The shortest path from user 1 to user 4 is through user 2.
Example 2:
Input: graph = {1: [2, 3, 5], 2: [1], 3: [1, 4], 4: [3], 5: [1, 6], 6: [5]}, start_id = 3, end_id = 6
Output: []
Explanation: There is no path from user 3 to user 6.
Constraints:
  • Number of nodes in the graph: 1 <= |V| <= 10^5

  • Number of edges in the graph: 0 <= |E| <= 10^5

  • user_id is a positive integer up to 10^6.

coding Medium graph #6

6. Graph Traversal — Implement a function to find the shortest path in a directed graph

Background: CodeSignal's platform includes various challenges that require understanding of graph structures and algorithms. Efficient pathfinding is crucial for problem-solving scenarios in coding assessments.
Problem statement: Given a directed graph represented as an adjacency list, your task is to write a function that finds the shortest path from a source node to a target node. The graph can have multiple nodes and edges, and you need to return the path as a list of nodes from source to target. If no path exists, return an empty list. Use BFS for traversal as it is optimal for unweighted graphs.
Function/class signature:
  • def shortest_path(graph: Dict[int, List[int]], source: int, target: int) -> List[int]:

Example 1:
Input: graph = {0: [1, 2], 1: [2], 2: [0, 3], 3: []}, source = 0, target = 3
Output: [0, 2, 3]
Explanation: The shortest path from node 0 to node 3 is achieved through node 2.
Example 2:
Input: graph = {0: [1], 1: [2], 2: [3], 3: []}, source = 0, target = 4
Output: []
Explanation: There is no path from node 0 to node 4.
Constraints:
  • The graph will contain unique nodes indexed from 0 to n-1

  • The number of nodes, n, will be at most 1000

  • The number of edges, m, can be up to 5000

  • Nodes will be represented as integers.

Start practicing CodeSignal OAs questions

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

Get Started Free