Master the signature Juspay problem that filters 80-85% of candidates in Hackathon Part A. Complete O(log n) solution guide with parent pointers, descendant count tracking, and targeted practice.
Juspay is accepting applications NOW on a rolling basis. Don't wait — apply today for ₹30K-40K/month internship!
The Tree of Space is the signature problem used in Juspay Hiring Challenge 2026 Hackathon Part A. It tests your ability to implement efficient lock/unlock operations on an M-ary tree (a tree where each node can have 0 to M children) with strict concurrency constraints and time complexity requirements.
This problem is infamous because it combines multiple advanced concepts: tree traversal, ancestor-descendant relationships, state management, and time complexity optimization. Only 15-20% of candidates pass this round — making it the single biggest filter in Juspay's hiring process.
📊 By the Numbers
This is THE problem that 1,350+ students searching "Juspay Hiring Challenge 2026" are desperately hunting for. If you don't master this, you won't get past Hackathon Part A. Here's the exact breakdown experienced candidates use.
The infamous problem: Implement lock/unlock operations on an M-Ary tree with concurrency constraints. This is THE differentiator — only 15-20% get past this.
Passing Criteria: Must pass 80%+ test cases. Edge cases and time limits are strict.
You are given an M-ary tree (each node can have 0 to M children). Implement `lock(node)`, `unlock(node)`, and `upgradeLock(node)` operations with the following constraints:
A node can be locked only if none of its ancestors or descendants are currently locked.
A node can be unlocked only if it is currently locked.
upgradeLock(node) locks a node and unlocks all its locked descendants, but only if no ancestor is locked.
All operations must run in O(log n) or O(h) time where h is tree height.
Real-World Mapping
This models permission systems (e.g., filesystem locks, database row locks, access control trees). Juspay tests if you can build efficient, concurrent-safe tree structures.
class TreeNode {
int id;
TreeNode parent;
List<TreeNode> children;
boolean isLocked;
int lockedBy; // user ID who locked this node
}Why this works: Store parent pointers to quickly traverse upward for ancestor checks.
boolean hasLockedAncestor(TreeNode node) {
TreeNode curr = node.parent;
while (curr != null) {
if (curr.isLocked) return true;
curr = curr.parent;
}
return false;
}Why this works: Walk up the tree to root — O(h) complexity. Store parent pointers for fast traversal.
// Maintain a count of locked descendants for each node
Map<TreeNode, Integer> lockedDescendantCount;
boolean hasLockedDescendant(TreeNode node) {
return lockedDescendantCount.get(node) > 0;
}Why this works: Maintain a count of locked descendants for each node. Update counts during lock/unlock operations. Avoid O(n) DFS on every query.
boolean lock(TreeNode node, int userId) {
if (node.isLocked) return false;
if (hasLockedAncestor(node)) return false;
if (hasLockedDescendant(node)) return false;
node.isLocked = true;
node.lockedBy = userId;
updateAncestorCounts(node, +1); // increment locked count in ancestors
return true;
}Why this works: Check ancestors and descendants. If clear, lock the node and update ancestor counts.
Key Insight (This is What Gets You Selected)
The O(log n) constraint forces you to avoid DFS on every query. Use parent pointers + descendant count tracking instead of naive tree traversals.
Don't waste time on generic DSA prep. Master the Tree of Space, learn the concurrency patterns, and practice the exact problem types Juspay tests.
Full breakdown of all 4 rounds, eligibility, CTC (₹19-27 LPA), and registration details.
Track your practice on LeetCode problems specific to Tree of Space preparation.
40+ pattern-based tree problems covering parent pointers, state management, and optimization.
Browse Flipkart GRiD, Adobe Hackathon, Goldman Sachs Challenge, and 15+ other opportunities.
Don't let the Tree of Space eliminate you. Master the O(log n) solution, practice the targeted LeetCode problems, and avoid the common pitfalls that trip up 80% of candidates.
Apply to Juspay Hiring Challenge 2026