Demand Base | Interview Experience | 4 yrs experience

demand base logo
demand base
Senior Software Engineer4 yearsRejected
March 22, 20252 reads

Summary

I interviewed for a Senior Software Engineer position at Demand Base, undergoing two intense technical rounds that covered Java fundamentals and data structures & algorithms. Despite my efforts, I was unfortunately rejected after the second round.

Full Experience

My interview experience at Demand Base for a Senior Software Engineer role was an on-site, face-to-face hiring drive.

Round 1: (1.5 hours)

This round focused heavily on Java concepts and data structures & algorithms. I was asked to explain the differences between final, finalize, and finally, and discussed Java's garbage collection mechanisms. A significant portion involved analyzing and predicting the output of provided Java code snippets. One such question required me to implement custom hashing logic for a CustomKey class to ensure its correct behavior as a HashMap key. Other theoretical questions included distinguishing between authentication and authorization, explaining the internal workings and time complexity of HashMap, and discussing the purpose of doFilter in Java Servlets. We also had a detailed conversation about pass-by-value versus pass-by-reference in Java. For coding, I was asked to find the maximum product of three elements in an array, considering various edge cases, and to write the code for the lowest common ancestor in a binary tree.

Round 2: (50 minutes)

This was another elimination round, primarily focused on algorithms. The first question was about converting a string s1 to s2 using a minimum number of operations, including Replace, Add, Delete, Swap, and Substitute. I found this question quite vague and needed clarification on the exact definition of some operations, and ultimately struggled to provide an optimal solution. The second question was a classic problem: merge k sorted linked lists using a priority queue. I was able to write a working solution for this, although I acknowledge it wasn't fully optimized.

Unfortunately, I was eliminated after the second round and did not proceed to the Hiring Manager round. The overall experience was challenging, requiring not just algorithmic knowledge but also a strong grasp of Java internals.

Interview Questions (10)

Q1
Difference between Final, Finalize, and Finally
Other

Explain the differences between the final keyword, the finalize() method, and the finally block in Java.

Q2
Custom Hashing for HashMap Key
OtherMedium

Given the following CustomKey class, predict the output of the System.out.print statement. Then, write the logic (implement hashCode() and equals() methods) within the CustomKey class to ensure HashMap correctly retrieves the value for a matching key.

class CustomKey {
   private int id; 
   private String name;

   public CustomKey(int id, String name) {
       this.id = id;
       this.name = name;
   }
}

public class Test {
   public static void main(String[] args) {
       Map<CustomKey, String> map = new HashMap<>();

       map.put(new CustomKey(1, "Alice"), "Value1");
       map.put(new CustomKey(2, "Bob"), "Value2");
       map.put(new CustomKey(3, "Charlie"), "Value3");

       System.out.print(map.get(new CustomKey(1, "Alice")));
   }
}
Q3
Authentication vs. Authorization
Other

Explain the key differences between authentication and authorization in the context of system security.

Q4
HashMap Internal Working and Time Complexity
Data Structures & AlgorithmsMedium

Discuss the internal working mechanism of a HashMap in Java, including how values are stored, collision resolution strategies, and the average and worst-case time complexities for common operations like put() and get().

Q5
Purpose of doFilter in Java Servlets
Other

Explain the purpose and usage of the doFilter method within a Java Servlet Filter. Describe its role in the request processing lifecycle.

Q6
Java Pass by Value/Reference and Object Mutation
OtherEasy

Given the CustomKey class (as defined previously) and the following methods, determine the output of sout(a.id) after each method call. Discuss the concepts of pass-by-value and how objects are handled in Java method calls.

CustomKey a = new CustomKey(1, "Alice");
a = new CustomKey(2, "Pasco");
test(a);
sout(a.id);
test1(a);
sout(a.id);

Public void test(CustomKey a){
	a = new CustomKey(4, "Bob");
}
Public void test1(CustomKey a){
	a.id = 3;
}
Q7
Maximum Product of Three Numbers
Data Structures & AlgorithmsEasy

Given an integer array, find three numbers whose product is maximum and return the maximum product. Discuss various edge cases, such as arrays with negative numbers or arrays shorter than three elements.

Q8
Lowest Common Ancestor of a Binary Tree
Data Structures & AlgorithmsMedium

Write code to find the lowest common ancestor (LCA) of two given nodes in a binary tree. Assume both nodes exist in the tree and are unique.

Q9
Minimum Operations to Convert String S1 to S2 (Extended Edit Distance)
Data Structures & AlgorithmsHard

Given two strings, s1 and s2, find the minimum number of operations required to convert s1 to s2. Allowed operations include: Replace, Add, Delete, Swap (adjacent characters), and Substitute (single character replacement). The exact definitions of 'Swap' and 'Substitute' might need clarification with the interviewer.

Q10
Merge k Sorted Lists
Data Structures & AlgorithmsHard

Merge k sorted linked lists into one single sorted linked list. Implement the solution using a priority queue.

Preparation Tips

The interview format required me to write complete, executable code from scratch, rather than just filling in a template as is common in many LeetCode environments. This meant I needed to be proficient in initializing data structures like binary trees and linked lists, in addition to implementing the core logic for the problems.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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