Interview Questions - Product Company
1. Spring vs Spring Boot
- Explain the difference between Spring and Spring Boot.
- What is the use of @Component and @Configuration annotations?
Coding Question:
Given an integer array nums, find the subarray with the largest sum, and return its sum.
Example:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation:
The subarray [4,-1,2,1] has the largest sum 6.
2. Majority Element & Two Sum
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than floor(n / 2) times.
Example 1:
Input: nums = [3,2,3]
Output: 3
Example 2:
Input: nums = [2,2,1,1,1,2,2]
Output: 2
Two Sum Problem:
Given an array of integers nums and an integer target, return indices of the two numbers
such that they add up to target.
Example 1:
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Example 2:
Input: nums = [3,2,4], target = 6
Output: [1,2]
Example 3:
Input: nums = [3,3], target = 6
Output: [0,1]
3. Java, SQL & Debugging Questions
- Explain polymorphism with code example using Animal, Dog, Cat etc.
- Write palindrome code.
- Find the index where target value can be inserted in a sorted array.
Example:
int nums[] = {1,5,7,12,15,20};
int target = 14;
Output: 4
- Binary Search implementation.
- Singleton Design Pattern with code.
- Find the second highest salary from Employee table.
- Difference between INNER JOIN and LEFT JOIN.
- How do you improve code quality in your project?
- How do you debug your code?
4. Java & SQL Questions
- Explain polymorphism with code example using Animal, Dog, Cat etc.
- Find the index where target value can be inserted in a sorted array.
Example:
int nums[] = {1,5,7,12,14,20};
int target = 14;
Output: 4
- Binary Search implementation.
- Difference between INNER JOIN and LEFT JOIN.
5. String, SQL & Spring Boot Questions
- Reverse a string array using O(1) space.
- Find the second highest distinct employee salary. If not found, return NULL.
- Difference between @Component and @Configuration in Spring Boot.
6. Daily Temperatures Problem
Given an array of integers temperatures representing daily temperatures, return an array
answer such that answer[i] is true if there is any warmer day after ith day.
Example 1:
Input: temperatures = [73,74,75,71,69,72,76,73]
Output: [true,true,true,true,true,true,false,false]
Example 2:
Input: temperatures = [30,40,50,60]
Output: [true,true,true,false]
Example 3:
Input: temperatures = [30,60,90]
Output: [true,true,false]