Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 3,901–3,925
Given an initial binary string and a set of allowed operations that can be applied any number of times, count how many distinct binary strings…
General practice
Count the number of distinct island shapes in a binary grid where two islands are considered identical if one can be translated, rotated (90/180/270°) or…
General practice
Count the number of length-n sequences of die faces (1..6) where every adjacent pair has gcd=1 and equal values are at least 3 positions apart…
General practice
Count the number of distinct substrings of a given string. Efficient solutions use suffix automata or suffix array + LCP (or rolling hashes) to avoid…
General practice
Count how many substrings of a given digit string represent base-10 numbers divisible by a given integer p. Solve by using modular arithmetic / rolling…
General practice
Count how many index triplets (i < j < k) in an integer array have a sum divisible by a given divisor K; the core…
General practice
Given an array hours and an integer target, return how many employees worked at least target hours (i.e., count elements >= target).
General practice
Count the number of land cells (1s) that belong to connected components that cannot reach the grid boundary. The core challenge is to identify and…
General practice
Count substrings of a given string in which every distinct character appears the same number of times. The challenge is to detect and efficiently count…
General practice
Given an integer array and multiple range queries, count how many contiguous blocks of equal numbers appear inside each queried subarray; the challenge is to…
General practice
Count how many index pairs (i < j) of dominoes are equivalent up to rotation (i.e., [a,b] equals [c,d] if {a,b} = {c,d}). Normalize each…
General practice
Count the 1-bits in n's binary representation at even and odd indices (indices numbered from 0 at the least significant bit) and return [even_count, odd_count].
General practice
Count ordered pairs (a, b) from values in nums whose bit-counts satisfy popcount(a)+popcount(b) >= k. Key insight: popcount(a|b)+popcount(a&b)=popcount(a)+popcount(b), so…
General practice
Given a list of closed time intervals for when each flower is in full bloom and query times for people arriving, return for each person…
Companies: Roblox
Array · Binary Search · Hash Table · Ordered Set
Count how many binary strings with length in [low, high] can be formed starting from an empty string and repeatedly appending either a block of…
General practice
Count how many index pairs (i < j) have equal values in the array. This reduces to aggregating value frequencies and summing the number of…
General practice
Count the number of distinct simple paths in a tree whose endpoints have equal values and every intermediate node has value ≤ that endpoint value…
General practice
Given a lowercase string s (n ≤ 1e5), count the split positions where the left and right substrings have the same number of distinct letters…
General practice
Count the number of ways to assign each element to one of two ordered groups so both group sums are at least k (mod 1e9+7)…
General practice
Count all distinct strictly increasing paths in an m×n grid where you may move to 4-directionally adjacent cells. Exploit that moves only go from smaller…
General practice
Count how many integers x in [1, n] take exactly k repeated applications of popcount (number of 1-bits) to reach 1 — equivalently, classify numbers…
General practice
Support point updates and range queries on an array that count how many elements have a given popcount-depth (the number of times you replace x…
General practice