Coding Challenges and Practice Flashcards
7 cards from real CodeSignal Technical Assessment practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Coding Challenges and Practice flashcards as text
A CodeSignal problem gives you a matrix and asks for the number of islands (connected groups of 1s). Which algorithm is best suited?
Answer: BFS or DFS flood-fill from each unvisited land cell
BFS or DFS starting from each unvisited '1' marks its entire island as visited, counting one island per launch.
You are given an integer array and must return the length of the longest increasing subsequence (LIS). What is the time complexity of the optimal patience-sorting solution?
Answer: O(n log n)
Binary search on a maintained 'piles' array processes each element in O(log n), giving O(n log n) total.
In a CodeSignal challenge, you must validate a set of parentheses including '(', ')', '{', '}', '[', ']'. Which structure is essential?
Answer: Stack (LIFO)
A stack's last-in-first-out behavior matches the requirement that the most recently opened bracket must be the next one closed.
What does the space complexity O(1) mean in the context of an in-place sorting algorithm?
Answer: The algorithm uses a fixed amount of additional memory beyond the input
O(1) space means the algorithm's extra memory usage does not grow with the input size.
A CodeSignal task requires implementing a min-heap. After inserting a new element, what operation restores the heap property?
Answer: Sift-up from the newly inserted position
Sift-up compares the new element with its parent and swaps upward until the heap property is restored.
Which recurrence relation correctly describes the time complexity of binary search?
Answer: T(n) = T(n/2) + O(1)
Binary search discards half the input each step and does constant work, giving T(n) = T(n/2) + O(1), which solves to O(log n).
In a CodeSignal coding challenge, memoization is used to optimize a recursive function. What does memoization store?
Answer: Previously computed results keyed by their input parameters
Memoization caches the output for each unique set of inputs so repeated calls return instantly without recomputation.