← Jump Trading Interview Insights

Jump Trading·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Jump Trading coding round, one algorithmic problem on bitwise operations. Pretty focused session, no fluff.

Questions Asked (1)

Q1

Given an array of positive integers, find the size of the largest subset where the bitwise AND of all elements in the subset is greater than zero.

Algorithms & Data Structures
Author's notes

The key insight is that AND being positive just means all elements in the subset share at least one common set bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

The key insight is that the bitwise AND of a subset is greater than zero if and only if there exists at least one bit position that is set in every element of the subset. Therefore, for each bit position, count how many numbers have that bit set; the maximum count across all bit positions is the size of the largest valid subset. This reduces the problem to a single pass through the array while tracking bit counts.

Pro tip: Mention that this solution runs in O(n * B) time where B is the number of bits (e.g., 32 for integers), which is effectively O(n). Also, clarify that the subset can be any size, including singletons, and that the answer is at least 1 if the array is non-empty.

1. Understand the condition

Realize that the bitwise AND of a subset is > 0 iff there is at least one bit position where all elements in the subset have that bit set. So we need to find the maximum number of elements sharing a common set bit.

2. Choose data structures

Use an array of size equal to the number of bits (e.g., 32) to count how many numbers have each bit set. Alternatively, use a hash map if the bit range is unknown, but an array is simpler and faster.

3. Iterate and count

For each number in the input array, iterate over its set bits (or all bit positions) and increment the corresponding counter. This can be done efficiently by checking each bit up to the maximum possible bit (e.g., 31 for 32-bit integers).

4. Find the maximum

After processing all numbers, the answer is the maximum value in the bit-count array. If the array is empty, return 0; otherwise, the answer is at least 1.

5. Analyze complexity

Time complexity is O(n * B) where B is the number of bits (constant, e.g., 32), so effectively O(n). Space complexity is O(B) which is O(1).

Key Points to Mention

  • Bitwise AND property: AND > 0 iff there is a common set bit among all elements.
  • Reduction to counting numbers with each bit set.
  • Time complexity O(n * B) with B = number of bits (e.g., 32), effectively O(n).
  • Space complexity O(B) = O(1).
  • Edge cases: empty array (return 0), all zeros (return 0), single element (return 1).
  • Alternative approach: for each bit, filter numbers with that bit set and take the maximum size; but counting is more efficient.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.