Cohesity Interview Experience
Summary
I recently interviewed with Cohesity and encountered a challenging binary tree dynamic programming problem, which I struggled to solve optimally during the coding round.
Full Experience
My interview at Cohesity commenced with approximately 10 minutes of discussion about my current role, day-to-day responsibilities, and the systems I actively work on. This initial conversation flowed quite naturally and was very conversational.
Following this, the interviewer transitioned to a coding problem:
Interview Questions (1)
Given a binary tree, find the maximum subset sum such that no two selected nodes are adjacent (meaning you cannot pick both a parent and its direct child).
This is akin to the "Maximum Sum of Non-Adjacent Nodes in a Binary Tree" problem, often compared to LeetCode's House Robber III.
Preparation Tips
This interview served as a significant reminder that tree problems frequently necessitate dynamic programming with multiple states. Specifically, when constraints like "cannot pick adjacent nodes" are present, thinking in terms of "include/exclude" states is crucial. It underscored the importance of consistently practicing classic patterns such as Tree DP and DFS with tailored return states. This experience highlighted key areas I needed to focus on, and I've since dedicated time to improving my proficiency in these specific problem types.