Adobe Hackathon MCQS 2026
A live leaderboard uses a Fenwick tree to maintain scores. During an update, a junior dev wrote:
void add(int i, int delta) {
for (; i <= n; i = i - (i & -i)) bit[i] += delta;
}
The prefix query is correct, but updates seem to "move backward" and miss indices. Which fix restores the standard BIT update traversal?
i = i - (i & -i) with i = i + (i & -i)(Note: Some options were cut off in the source image)
An R&D system clones linked graphs with next and random references. The developer merges clone nodes into the original list alternately during copy. Which step completes the correct O(1)-space cloning process?
(Note: Options were partially visible in the source image)
A distributed ETL pipeline eagerly merges incoming data chunks greedily by always combining the two smallest files.
heapify(files)
while len(files) > 1:
cost = heappop(files) + heappop(files)
total_cost += cost
heappush(files, cost)
If the dataset is files = [4, 3, 2, 6], what is the exact final total_cost reliably computed by this optimal greedy logic?
You maintain many versions of a Persistent Segment Tree, where multiple versions may share internal nodes. Each version is identified by a separate root pointer.
The range query logic is identical to a standard segment tree implementation.
int query(Node* node, int tl, int tr, int l, int r) {
if (!node || l > r) return 0;
if (l == tl && r == tr) return node->sum;
int tm = (tl + tr) / 2;
return query(node->left, tl, tm, l, min(r, tm))
+ query(node->right, tm + 1, tr, max(l, tm + 1), r);
}
(Note: Options were partially visible in the source image)
Consider a nested loop where the outer loop index i ranges from 1 to n, and for each outer iteration, the inner loop index j starts at 1 and repeatedly doubles until it exceeds n, so the inner loop executes O(log n) times. Each inner iteration performs an operation that takes O(i) time, where the cost depends on the outer index. What is the overall time complexity of this structure?
A payments platform reconciles signed ledger deltas where refunds and adjustments can reduce running totals. A senior engineer rejects a sliding-window scan because several valid ranges may include negative values. A reviewer proposes a single pass that tracks cumulative totals and returns any matching contiguous range. A regression appears when lookup order or difference direction is changed around the stored cumulative state. A candidate must complete the marked block so the implementation remains negative-inclusive and linear.
pair findRange(vector<int>& arr, int target) {
unordered_map<int, int> hm;
int curr_sum = 0;
for (int i = 0; i < arr.size(); i++) {
curr_sum += arr[i];
if (curr_sum == target)
return {0, i};
// Which missing block best completes the implementation?
hm[curr_sum] = i;
}
return {-1, -1};
}
(Note: Options were partially visible in the source image)
An analytics service stores an unrooted tree of account transfers and, for every possible root, must compute a subtree aggregate used by a fraud score. Each directed edge value is cached after a DFS call, and a prototype deletes processed adjacency entries so high-degree vertices are not rescanned on every call. The prototype works for a distance-pair aggregate where removing one neighbour's effect is implemented by subtraction. A new product rule changes the merge to an associative operation that has no reliable inverse, while the latency target still requires total linear work and the original adjacency may be copied once but should not be rebuilt per root. The reviewer must decide how to preserve the same directed-edge cache idea without silently dropping or duplicating a neighbour contribution.
Which design should replace the inverse-based exclusion step?
An optimization review checks a Java solver used only for boards that fit inside a signed integer mask. The service accepts n and compares counts against a trusted slow solver. For n = 4 and n = 5, this version undercounts even though it terminates and never stores board rows. The reviewer is not allowed to replace the approach with arrays or sets and must identify the precise state-transition defect.
int solve(int n) {
int m = (1 << n) - 1;
return dfs(m, 0, 0, 0);
}
int dfs(int m, int d1, int col, int d2) {
if (col == m) {
return 1;
}
int open = m & ~(d1 | col | d2);
int total = 0;
while (open != 0) {
int bit = open & -open;
open ^= bit;
total += dfs(m, (d1 | bit) << 1, col | bit, (d2 | bit) << 1);
}
return total;
}
A compliance platform imports partner-provided binary trees as candidate search indexes before enabling range-based reads. The validator must reject duplicate keys, preserve strict ordering across every descendant relationship, and handle keys equal to Integer.MIN_VALUE or Integer.MAX_VALUE without sentinel collisions. A recent incident passed a tree where a lower descendant satisfied its immediate parent but crossed an ordering boundary created several levels above, causing range queries to skip live records. The reviewer now compares Java helpers used by validate(root) and wants the implementation that accepts exactly valid search indexes, rejects ancestor-boundary violations, and avoids modifying nodes or building an inorder list.
Which helper should be accepted?
java boolean ok(TreeNode x, long lo, long hi) { if (x == null) return true; if (x.left != null && x.left.val >= x.val) return false; if (x.right != null && x.right.val <= x.val) return false; return ok(x.left, lo, hi) && ok(x.right, lo, hi); } java boolean ok(TreeNode x, long lo, long hi) { if (x == null) return true; if (x.val <= lo || x.val >= hi) return false; return ok(x.left, lo, x.val) && ok(x.right, x.val, hi); } java boolean ok(TreeNode x, long lo, long hi) { if (x == null) return true; if (x.val >= lo || x.val <= hi) return false; return ok(x.left, lo, x.val) && ok(x.right, lo, hi); } java boolean ok(TreeNode x, long lo, long hi) { if (x == null) return true; if (x.val < lo || x.val > hi) return false; return ok(x.left, lo, x.val) && ok(x.right, x.val, hi); } A team integrates Dinic's algorithm into a traffic-routing engine. Flow occasionally exceeds edge capacity invariants after multiple phases.
DFS code:
int dfs(int u, int pushed) {
if (pushed == 0) return 0;
for (auto &e : adj[u]) {
if (e.cap > 0) {
int tr = dfs(e.to, min(pushed, e.cap));
if (tr) {
e.cap -= tr;
adj[e.to][e.rev].cap += tr;
return tr;
}
}
}
return 0;
}
BFS builds level[] correctly.
Which missing condition is directly responsible for violating Dinic's correctness?
level[e.to] == level[u] + 1pushed > 0u == sinke.rev >= 0A cloud storage system uses a trie to index filenames. Users frequently search for partial matches (e.g., "doc" for "document.pdf"). The current implementation traverses the entire trie for wildcard queries, causing latency. Which optimization reduce