JPMorgan Chase & Co.
HSBC Group Interview Questions and Answers
Q1. Longest Increasing Path in Matrix Problem Statement
Given a 2-D matrix mat
with 'N' rows and 'M' columns, where each element at position (i, j) is mat[i][j]
, determine the length of the longest increasing path ...read more
The problem involves finding the length of the longest increasing path in a 2-D matrix starting from a given cell.
Use dynamic programming to keep track of the longest increasing path starting from each cell.
Implement a recursive function to explore all possible paths from a cell.
Update the length of the longest path for each cell based on the maximum path length from its neighbors.
Consider edge cases such as boundary conditions and handling negative values in the matrix.
Q2. Arithmetic Progression Queries Problem Statement
Given an integer array ARR
of size N
, perform the following operations:
- update(l, r, val):
Add (val + i)
to arr[l + i]
for all 0 ≤ i ≤ r - l
.
- rangeSum(l, r):...read more
Implement update and rangeSum operations on an integer array based on given queries.
Implement update(l, r, val) by adding (val + i) to arr[l + i] for all i in range (0, r - l).
Implement rangeSum(l, r) to return the sum of elements in the array from index l to r.
Handle queries using 1-based indexing.
Ensure constraints are met for input values.
Output the sum of arr[l..r] for each rangeSum operation.
Q3. Pattern Matching Problem Statement
Given a pattern as a string and a set of words, determine if the pattern and the words list align in the same sequence.
Input:
T (number of test cases)
For each test case:
patte...read more
The problem involves determining if a given pattern aligns with a list of words in the same sequence.
Iterate through the pattern and words list simultaneously to check for matching sequences.
Use a hashmap to store the mapping between characters in the pattern and words in the list.
Compare the mappings to determine if the pattern and words align in the same sequence.
Q4. Easy Leetcode Problem: Count of substrings with no repeating characters
Count substrings with unique characters in a given string
Use a sliding window approach to keep track of unique characters in a substring
Use a set to store characters in the current window and update the window accordingly
Increment the count of valid substrings whenever a new character is added to the set
Q5. Debugging a Java Code
Debugging a Java code involves identifying and fixing errors in the code to ensure it runs correctly.
Start by understanding the error message or symptoms of the issue.
Use debugging tools like breakpoints, watches, and logging to track the flow of the code.
Review the code logic and check for common mistakes like typos, incorrect variable assignments, or logic errors.
Test different scenarios to reproduce the issue and narrow down the root cause.
Consider code reviews or pair pro...read more
Q6. Design Parking System
Design a parking system with different types of parking spots
Create classes for different types of parking spots (e.g. compact, regular, handicap)
Implement methods for checking availability, reserving, and releasing spots
Consider implementing a parking lot class to manage all parking spots
More about working at JPMorgan Chase & Co.
Interview Process at HSBC Group
Top SDE-2 Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month