cognitree logo

Cognitree Interviews

1 experience41 reads
Cognitree | Interview Experience | SDE 2
cognitree logo
Cognitree
SDE 2Rejected
August 14, 202541 reads

Summary

I interviewed for an SDE 2 position at Cognitree, facing a mix of DSA, Java, and OOPS questions. Although I performed well on most DSA problems, I was ultimately rejected after struggling with a specific HashSet conceptual question.

Full Experience

I recently interviewed for an SDE 2 role at Cognitree, and the process consisted of two rounds.

In the first round, the focus was entirely on Data Structures and Algorithms. I was given two problems: 'Insert Interval' and 'K Most Frequent Elements'. I was able to provide complete solutions for both, and felt that this round went very smoothly for me.

The second round was a combination of Java, OOPS, and DSA. We had discussions around core Java concepts, OOPS principles, and SOLID principles. A specific problem involved understanding how HashSet handles duplicate custom objects, requiring knowledge of equals() and hashCode(). Additionally, I was presented with two more DSA problems: 'Longest Substring Without Repeating Characters' and 'Longest Substring With At Most 2 Distinct Characters'.

I felt confident about my DSA solutions in the second round as well. However, I realized afterward that I had missed the precise explanation for the HashSet duplicate scenario, which was a critical point. This experience taught me the importance of always recalling the behavior of equals() and hashCode() methods for such cases. Unfortunately, I received a rejection, which I believe was primarily due to my struggle with that particular conceptual question.

Interview Questions (5)

Q1
Insert Interval
Data Structures & Algorithms

Given a set of non-overlapping intervals, insert a new interval (merge if needed).

Q2
K Most Frequent Elements
Data Structures & Algorithms

Return the k most frequent elements from an array.

Q3
HashSet Duplicate Check for Custom Objects
Other

Discuss how to ensure that a HashSet<Student> only stores unique Student objects (e.g., 'tom' only once) even if new Student('tom') is added multiple times. This requires understanding the implementation of equals() and hashCode() methods.

Q4
Longest Substring Without Repeating Characters
Data Structures & Algorithms

Given a string, find the length of the longest substring without repeating characters. Example: "abcabcbb" → 3.

Q5
Longest Substring With At Most 2 Distinct Characters
Data Structures & Algorithms

Given a string, find the length of the longest substring that contains at most 2 distinct characters. Example: "adanm" → 3.

Have a Cognitree Interview Experience to Share?

Help other candidates by sharing your interview experience. Your insights could make the difference for someone preparing for their dream job at Cognitree.