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,876–1,900
Count the number of index-ordered quadruplets (a < b < c < d) in an array such that nums[a] + nums[b] + nums[c] == nums[d]…
General practice
Count the number of length-4 subsequences (p<q<r<s) with q-p, r-q, s-r >= 2 such that nums[p]*nums[r] == nums[q]*nums[s]. The core challenge is efficiently counting equal…
General practice
Count the number of index triplets (i<j<k) where nums[i] and nums[k] both equal 2 * nums[j]; this reduces to, for each j, multiplying the count…
General practice
Given a binary m×n matrix, count the total number of square submatrices that consist entirely of 1s. This is commonly solved with a dynamic programming…
General practice
Count the number of ordered integer Pythagorean triples (a, b, c) with 1 ≤ a, b, c ≤ n — i.e., how many pairs (a…
General practice
Count how many integers in the inclusive range [low, high] (given as decimal strings up to 100 digits) have every pair of adjacent digits differ…
General practice
Count the number of contiguous subarrays whose elements are strictly increasing; the core challenge is to identify maximal strictly increasing runs and aggregate how many…
General practice
Given Department and Student tables, compute the number of students in each department using joins and aggregation; be sure to include departments with zero students…
General practice
Count the number of contiguous subarrays whose maximum element occurs at least k times; the challenge is to avoid brute force by efficiently using the…
General practice
Companies: Media.net
Array · Binary Indexed Tree · Binary Search · Prefix Sum
Companies: Meta
Array · Counting · Hash Table · Sliding Window
Companies: Amazon, Bloomberg, Google, Meta +1
Array · Counting · Divide and Conquer · Hash Table
Companies: Amazon, Microsoft
Array · Divide and Conquer · Hash Table · Merge Sort
Count how many contiguous subarrays of a distinct-integer array have median equal to k (median is the middle element, or the left-middle for even lengths)…
General practice
Given a binary array, count subarrays where the number of 1s exceeds the number of 0s by mapping 1→1 and 0→-1 so the problem becomes…
General practice
Count the number of non-empty contiguous subarrays of a positive-integer array whose score—defined as (sum of elements) × (subarray length)—is strictly less than k. With…
General practice
Count the number of submatrices in an m×n binary matrix that consist entirely of 1s. Efficient approaches treat each row as the base of a…
General practice
Count the number of axis-aligned submatrices in a 2D grid of 'X', 'Y', and '.' that contain at least one 'X' and have an equal…
General practice
Count how many submatrices that include the top-left cell (0,0) have sum ≤ k in an m×n matrix of nonnegative integers. Use the non-negativity and…
General practice
Count how many substrings of a digit string represent numbers divisible by their nonzero last digit. Because n ≤ 1e5, the solution must avoid O(n^2)…
General practice