Add office photos
Premium Employer

Zomato

3.8
based on 2.2k Reviews
Filter interviews by

10+ Kalpa Power Private Limited Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. LFU Cache Design Problem

Design and implement a Least Frequently Used (LFU) Cache with the following functionalities:

1. put(U__ID, value): Insert the value in the cache if the key ('U__ID') is not already pres...read more
Ans.

Design and implement a Least Frequently Used (LFU) Cache with put and get functionalities, handling capacity and frequency of use.

  • Implement a LFU cache with put and get functions

  • Handle capacity and frequency of use for eviction

  • Return the value of key if present, -1 otherwise

  • Consider multiple elements with least frequency, remove least recently used

  • Example: Insert, update, and retrieve values based on operations

Add your answer

Q2. Maximize the Sum Through Two Arrays

You are given two sorted arrays of distinct integers, ARR1 and ARR2. If there is a common element in both arrays, you can switch from one array to the other.

Your task is to ...read more

Ans.

Given two sorted arrays, find the path through common elements for maximum sum.

  • Start with the array containing the smaller first common element

  • Switch arrays at common elements to maximize the sum

  • Continue adding elements until the end of the arrays

Add your answer

Q3. Find All Pairs Adding Up to Target

Given an array of integers ARR of length N and an integer Target, your task is to return all pairs of elements such that they add up to the Target.

Input:

The first line conta...read more
Ans.

Given an array of integers and a target, find all pairs of elements that add up to the target.

  • Iterate through the array and for each element, check if the complement (target - current element) exists in a hash set.

  • If the complement exists, add the pair to the result. If not, add the current element to the hash set.

  • Handle cases where the same element is used twice in a pair by keeping track of the frequency of elements.

  • Return (-1, -1) if no pair is found.

  • Time complexity: O(N),...read more

Add your answer

Q4. Convert a Binary Tree to a Sum Tree

Given a binary tree of integers, convert the binary tree into a sum tree where each node's value is replaced by the sum of the values of its left and right subtrees in the or...read more

Ans.

Convert a binary tree into a sum tree where each node's value is replaced by the sum of its left and right subtrees.

  • Traverse the tree in postorder fashion to calculate the sum of left and right subtrees for each node.

  • Set leaf nodes to zero.

  • Update the node values with the sum of left and right subtrees.

Add your answer
Discover Kalpa Power Private Limited interview dos and don'ts from real experiences

Q5. Reverse Doubly Linked List in Groups Problem

You are provided with a Doubly Linked List consisting of integers and a positive integer 'K', which represents the size of the group. Your task is to modify the link...read more

Ans.

Reverse groups of K nodes in a doubly linked list

  • Iterate through the linked list in groups of size K

  • Reverse each group of nodes

  • Handle cases where the number of remaining nodes is less than K

Add your answer

Q6. Largest Rectangle in Histogram Problem Statement

You are given an array/list HEIGHTS of length N, where each element represents the height of a histogram bar. The width of each bar is considered to be 1.

Your t...read more

Ans.

Calculate the area of the largest rectangle that can be formed within the bounds of a given histogram.

  • Iterate through the histogram bars and maintain a stack to keep track of increasing heights.

  • Calculate the area of the rectangle formed by each bar as the smallest height in the stack multiplied by the width.

  • Update the maximum area found so far and return it as the result.

Add your answer
Are these interview questions helpful?

Q7. Number of Islands Problem Statement

You are provided with a 2-dimensional matrix having N rows and M columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more

Ans.

Count the number of islands in a 2D matrix of 1s and 0s.

  • Use Depth First Search (DFS) or Breadth First Search (BFS) to traverse the matrix and identify connected groups of 1s.

  • Maintain a visited array to keep track of visited cells to avoid redundant traversal.

  • Increment the island count each time a new island is encountered.

  • Consider all eight possible directions for connectivity between cells.

  • Handle edge cases such as boundary conditions and invalid inputs.

  • Example: For the give...read more

Add your answer

Q8. Snake and Ladder Problem Statement

Given a Snake and Ladder Board with 'N' rows and 'N' columns filled with numbers from 1 to N*N starting from the bottom left of the board, and alternating direction each row, ...read more

Ans.

Find the minimum number of dice throws required to reach the last cell on a Snake and Ladder board.

  • Use Breadth First Search (BFS) algorithm to find the shortest path on the board.

  • Create a mapping of each cell to its next possible moves based on dice outcomes.

  • Consider the snakes and ladders on the board while calculating the next possible moves.

  • Track the number of dice throws needed to reach each cell and update it as you explore the board.

  • Return the minimum number of throws n...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Deletion In Doubly Linked List

You are given a Doubly Linked List with 'N' positive integers. Your task is to delete a node at a given position 'POS' in this linked list.

Input:

The first line of input specifie...read more
Ans.

Implement a function to delete a node at a given position in a Doubly Linked List.

  • Traverse to the node at the specified position in the Doubly Linked List.

  • Adjust the pointers of the previous and next nodes to remove the node at the specified position.

  • Update the pointers accordingly to maintain the integrity of the Doubly Linked List.

  • Handle edge cases such as deleting the head or tail node.

  • Ensure to free the memory of the deleted node to avoid memory leaks.

Add your answer
Q10. Can you explain polymorphism and provide examples of real-time and run-time polymorphism?
Ans.

Polymorphism is the ability of a function or method to behave differently based on the object it is called on.

  • Polymorphism allows objects of different classes to be treated as objects of a common superclass.

  • Real-time polymorphism is achieved through method overloading, where multiple methods have the same name but different parameters.

  • Run-time polymorphism is achieved through method overriding, where a subclass provides a specific implementation of a method defined in its sup...read more

Add your answer
Q11. Write a SQL query to find the X percentile of students.
Ans.

SQL query to find the X percentile of students

  • Use the NTILE() function to divide students into X groups

  • Calculate the total number of students and the number of students in each group

  • Select the students from the group that corresponds to the X percentile

Add your answer
Q12. How would you design Instagram?
Ans.

Designing Instagram involves creating a user-friendly platform for sharing photos and videos with social networking features.

  • Focus on a clean and intuitive user interface for easy navigation

  • Implement features like photo filters, stories, direct messaging, and explore page

  • Incorporate algorithms for personalized content recommendations

  • Ensure robust security measures for user data protection

  • Integrate advertising options for monetization

  • Support for both web and mobile platforms

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

Top Software Developer Intern Interview Questions from Similar Companies

4.4
 • 30 Interview Questions
3.8
 • 21 Interview Questions
3.4
 • 13 Interview Questions
3.7
 • 12 Interview Questions
4.2
 • 12 Interview Questions
3.9
 • 10 Interview Questions
View all
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
70 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