Add office photos
Engaged Employer

SquadStack

3.5
based on 229 Reviews
Filter interviews by

10+ HDFC Bank Interview Questions and Answers

Updated 5 Feb 2024

Q1. Left View of a Binary Tree

Given a binary tree, your task is to print the left view of the tree. The left view of a binary tree contains the nodes visible when the tree is viewed from the left side.

Input:

The ...read more
Ans.

The task is to print the left view of a binary tree, which contains the nodes visible when viewed from the left side.

  • Traverse the binary tree level by level and keep track of the leftmost node at each level.

  • Use a queue for level order traversal and maintain a count of nodes at each level.

  • Print the leftmost node at each level to get the left view of the binary tree.

Add your answer

Q2. Arithmetic Expression Evaluation Problem Statement

You are provided with a string expression consisting of characters '+', '-', '*', '/', '(', ')' and digits '0' to '9', representing an arithmetic expression in...read more

Ans.

Evaluate arithmetic expressions in infix notation with given operators and precedence rules.

  • Parse the infix expression to postfix using a stack and then evaluate the postfix expression using another stack

  • Handle operators precedence and associativity while converting to postfix

  • Use a stack to keep track of operands and operators during evaluation

  • Ensure to handle parentheses properly to maintain correct order of operations

Add your answer

Q3. Reverse Words in a String: Problem Statement

You are given a string of length N. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more

Ans.

Reverse words in a string word by word, removing leading/trailing spaces and extra spaces between words.

  • Split the input string by spaces to get individual words

  • Reverse the order of the words

  • Join the reversed words with a single space in between

  • Remove any leading or trailing spaces

Add your answer

Q4. Longest Common Subsequence Problem Statement

Given two strings STR1 and STR2, determine the length of their longest common subsequence.

A subsequence is a sequence that can be derived from another sequence by d...read more

Ans.

The task is to find the length of the longest common subsequence between two given strings.

  • Implement a function to find the longest common subsequence between two strings.

  • Use dynamic programming to solve this problem efficiently.

  • Iterate through the strings and build a matrix to store the lengths of common subsequences.

  • Return the length of the longest common subsequence found.

Add your answer
Discover HDFC Bank interview dos and don'ts from real experiences

Q5. Maximum Subarray Sum Problem Statement

Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array.

Example:

Input:
array = [34, -50, 42, 14, -5, 86]
Output:
137
E...read more
Ans.

Find the maximum sum of any contiguous subarray within an array of integers.

  • Iterate through the array and keep track of the maximum sum of subarrays encountered so far.

  • At each index, decide whether to include the current element in the subarray or start a new subarray.

  • Update the maximum sum if a new maximum is found.

  • Time complexity should be O(N) to iterate through the array once.

  • Example: For array [34, -50, 42, 14, -5, 86], the maximum subarray sum is 137.

Add your answer

Q6. Find Duplicates in an Array

Given an array ARR of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.

Return the duplicate elements in any order. If n...read more

Ans.

Identify duplicate elements in an array of integers within a specified range.

  • Iterate through the array and keep track of the frequency of each element using a hashmap.

  • Return elements with frequency greater than 1 as duplicates.

  • Handle edge cases such as empty array or no duplicates found.

  • Example: For input [0, 3, 1, 2, 3], output should be [3].

Add your answer
Are these interview questions helpful?

Q7. Covid Vaccination Distribution Problem

As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more

Ans.

The task is to plan an effective vaccination schedule to maximize the number of vaccines administered on a particular day, while adhering to certain rules.

  • Given 'n' days for vaccination drive, 'maxVaccines' available, and 'dayNumber' to maximize vaccines on.

  • Distribute vaccines each day with a positive number, ensuring the difference between consecutive days is not more than 1.

  • Output the maximum number of vaccines administered on the specified 'dayNumber'.

  • Example: For n=3, day...read more

Add your answer

Q8. Factorial of a Number Problem Statement

You are provided with an integer 'N'. Your task is to calculate and print the factorial of 'N'. The factorial of a number 'N', denoted as N!, is the product of all positi...read more

Ans.

Calculate and print the factorial of a given integer 'N'.

  • Iterate from 1 to N and multiply each number to calculate factorial

  • Handle edge cases like N=0 or N=1 separately

  • Use recursion or iterative approach to calculate factorial

Add your answer
Share interview questions and help millions of jobseekers 🌟
Q9. How would you design a parking lot system?
Ans.

Designing a parking lot system involves layout planning, ticketing system, payment methods, security measures, and efficient traffic flow.

  • Layout planning to maximize space and accommodate different types of vehicles

  • Implementing a ticketing system for entry and exit tracking

  • Offering various payment methods such as cash, credit card, and mobile payments

  • Installing security measures like CCTV cameras and automated gates

  • Ensuring efficient traffic flow with clear signage and design...read more

Add your answer
Q10. What are the ACID properties in database management systems?
Ans.

ACID properties are a set of properties that guarantee reliability and consistency in database transactions.

  • Atomicity: Ensures that all operations in a transaction are completed successfully or none at all.

  • Consistency: Ensures that the database remains in a consistent state before and after the transaction.

  • Isolation: Ensures that the execution of multiple transactions concurrently does not interfere with each other.

  • Durability: Ensures that once a transaction is committed, its...read more

Add your answer
Q11. What is an Inner Join?
Ans.

Inner Join is a type of SQL join that returns only the rows with matching values in both tables.

  • Inner Join combines rows from two tables based on a related column between them

  • It returns only the rows where there is a match between the columns in both tables

  • Non-matching rows are not included in the result set

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter