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 1,851–1,875
Count the number of index pairs (i < j) whose hours sum to a multiple of 24 — equivalently, whose values' remainders mod 24 complement…
General practice
Count the number of index pairs (i < j) in an array whose elements sum to less than a given target — a two-sum variant…
General practice
Count the number of index pairs (i<j) whose XOR falls within [low, high]; the challenge is to do better than O(n^2) by computing, for each…
General practice
Count the number of split indices i (0 <= i < n-1) where the sum difference between the left and right subarrays is even; note…
General practice
Count the number of ways to split an array into one or more contiguous segments so that in every segment the difference between its maximum…
General practice
Count pairs of nodes in a rooted tree whose path edge-letters can be rearranged into a palindrome — equivalently, the multiset of letters on the…
Companies: Goldman Sachs
Bit Manipulation · Depth-First Search · Hash Table · Tree
Count the number of right/down paths from the top-left to bottom-right of an m×n grid whose XOR of visited cell values equals k (values and…
General practice
Given lamps along a street where each lamp illuminates a contiguous range of positions, count how many positions receive exactly a target brightness from overlapping…
General practice
Count the number of index pairs (i < j) such that words[i] is both a prefix and a suffix of words[j] (i.e., words[j] starts and…
General practice
Count pairs (i < j) where words[i] is both a prefix and a suffix of words[j]. With up to 5e5 total characters, the challenge is…
General practice
Count how many strings in the given array words are prefixes of s (i.e., equal to the starting substring of s); duplicate entries in words…
General practice
Count the contiguous subarrays that contain at least two prime numbers and whose maximum prime minus minimum prime is ≤ k; with n up to…
General practice
Count how many prime numbers are strictly less than a given integer n. The challenge is to generate primes efficiently (e.g., Sieve of Eratosthenes) to…
General practice
Companies: Microsoft
Array · Dynamic Programming · Matrix · Prefix Sum
Classify each account's income into three salary buckets (<20000, 20000–50000, >50000) and return the count of accounts in each category, ensuring all three categories appear…
General practice
Companies: Google, LinkedIn
Array · Dynamic Programming · Math · Memoization
Given an m×n binary grid where 1s are servers, count how many servers have at least one other server in the same row or the…
General practice
Count how many length-n strings over the vowels {a,e,i,o,u} are non-decreasing (lexicographically sorted); this is equivalent to counting combinations with repetition…
General practice
Count how many positive integers ≤ n have all distinct digits; due to the bound up to 2×10^9, solve by combining combinatorics for full-length counts…
General practice