cognitree logo
Cognitree· SDE 2

Cognitree | Interview Experience | SDE 2

Result
Rejected
Posted
14 Aug 2025
324 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.

How it went

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.

Questions asked (5)

  1. 01

    Insert Interval

    Data Structures & Algorithms

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

  2. 02

    K Most Frequent Elements

    Data Structures & Algorithms

    Return the k most frequent elements from an array.

  3. 03

    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.

  4. 04

    Longest Substring Without Repeating Characters

    Data Structures & Algorithms

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

  5. 05

    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Cognitree recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!