Add office photos
Engaged Employer

JPMorgan Chase & Co.

4.0
based on 6.1k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

20+ Vertiv Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Rectangle Counting on an N x N Chessboard

Given a positive integer N, determine the number of possible rectangles that can be formed on an N x N chessboard, excluding squares.

Input:

The first line contains an ...read more
Ans.

Count the number of rectangles (excluding squares) that can be formed on an N x N chessboard.

  • Calculate total rectangles using formula N*(N+1)*M*(M+1)/4 where M = N-1

  • Subtract the number of squares (N*(N+1)*(2*N+1)/6) from total rectangles

  • Return the count modulo 1000000007 for each test case

Add your answer

Q2. 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

Q3. Sudoku Solver Problem Statement

You are provided with a 9x9 2D integer matrix MAT representing a Sudoku puzzle. The empty cells in the Sudoku are denoted by zeros, while the other cells contain integers from 1 ...read more

Ans.

Implement a function to solve a Sudoku puzzle by filling empty cells with valid numbers.

  • Iterate through each empty cell and try filling it with a valid number (1-9) that satisfies Sudoku rules.

  • Use backtracking to backtrack and try different numbers if a cell cannot be filled with a valid number.

  • Check rows, columns, and 3x3 sub-grids to ensure each digit appears only once.

  • Recursively solve the puzzle until all empty cells are filled with valid numbers.

Add your answer

Q4. Fastest Horse Problem Statement

Given ‘N’ horses running in separate lanes, each horse's finish time is provided in an array. You are tasked to process 'Q' queries. For each query, determine the time taken by t...read more

Ans.

Given finish times of horses, determine fastest horse in specified lane ranges for multiple queries.

  • Iterate through each query and find the minimum finish time within the specified range of horses.

  • Use a nested loop to handle multiple test cases and queries efficiently.

  • Ensure to handle edge cases like empty ranges or invalid inputs.

  • Consider using a data structure like arrays to store finish times and process queries.

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

Q5. Rearrange Words in a Sentence

You are provided with a sentence 'TEXT'. Each word in the sentence is separated by a single space, and the sentence starts with a capital letter. Your task is to rearrange the word...read more

Ans.

Rearrange words in a sentence based on increasing order of their length.

  • Split the sentence into words and calculate the length of each word.

  • Sort the words based on their lengths in increasing order.

  • If two words have the same length, maintain their original order from the input sentence.

Add your answer

Q6. Sudoku Validity Problem Statement

You are provided with a 9 x 9 2D matrix MATRIX containing digits (1-9) and empty cells indicated by 0.

Your task is to determine if there exists a method to fill all empty cell...read more

Ans.

Check if a valid Sudoku solution exists for a given 9x9 matrix with empty cells.

  • Iterate through each row, column, and sub-matrix to ensure all digits from 1 to 9 appear exactly once.

  • Use sets to keep track of digits seen in each row, column, and sub-matrix.

  • If any digit is repeated in a row, column, or sub-matrix, return 'no'.

  • If all rows, columns, and sub-matrices pass the validity check, return 'yes'.

Add your answer
Are these interview questions helpful?

Q7. Kth Largest Number Problem Statement

You are given a continuous stream of numbers, and the task is to determine the kth largest number at any moment during the stream.

Explanation:

A specialized data structure ...read more

Ans.

Design a data structure to find the kth largest number in a continuous stream of integers.

  • Design a specialized data structure to handle continuous stream of numbers

  • Implement add(DATA) function to add integers to the pool

  • Implement getKthLargest() function to retrieve the kth largest number

  • Maintain the pool of numbers and update it based on queries

  • Output the kth largest number for each Type 2 query

Add your answer

Q8. Intersection of Linked List Problem

You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.

Your task is to determine the data...read more

Ans.

Find the node where two linked lists merge.

  • Traverse both lists to find their lengths and the difference in lengths.

  • Move the pointer of the longer list by the difference.

  • Traverse both lists simultaneously until they meet at the merging node.

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

Q9. Distance Between Two Nodes in a Binary Tree

Given a binary tree and the values of two distinct nodes, determine the distance between these two nodes in the tree. The distance is defined as the minimum number of...read more

Ans.

Calculate the distance between two nodes in a binary tree.

  • Traverse the tree to find the paths from the root to each node

  • Find the lowest common ancestor of the two nodes

  • Calculate the distance by adding the distances from the LCA to each node

Add your answer

Q10. Next Greater Number Problem Statement

Given a string S which represents a number, determine the smallest number strictly greater than the original number composed of the same digits. Each digit's frequency from...read more

Ans.

The task is to find the smallest number greater than the given number with the same set of digits.

  • Iterate from right to left to find the first digit that can be swapped with a smaller digit to make the number greater.

  • Swap this digit with the smallest digit to its right that is greater than it.

  • Sort all digits to the right of the swapped digit in ascending order to get the smallest number greater than the original.

  • If no such number exists, return -1.

  • Example: For input '56789', ...read more

Add your answer

Q11. Problem: Sort an Array of 0s, 1s, and 2s

Given an array/list ARR consisting of integers where each element is either 0, 1, or 2, your task is to sort this array in increasing order.

Input:

The input starts with...read more
Ans.

Sort an array of 0s, 1s, and 2s in increasing order.

  • Use a three-pointer approach to sort the array in a single pass.

  • Initialize three pointers for 0, 1, and 2 values and iterate through the array.

  • Swap elements based on the values encountered to achieve the sorted array.

Add your answer

Q12. Shortest Path in a Binary Matrix Problem Statement

Given a binary matrix of size N * M where each element is either 0 or 1, find the shortest path from a source cell to a destination cell, consisting only of 1s...read more

Ans.

Find the shortest path in a binary matrix from a source cell to a destination cell consisting only of 1s.

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

  • Keep track of visited cells to avoid revisiting them.

  • Update the path length as you traverse the matrix.

  • Return -1 if no valid path exists.

Add your answer

Q13. Most Frequent Non-Banned Word Problem Statement

Given a paragraph consisting of letters in both lowercase and uppercase, spaces, and punctuation, along with a list of banned words, your task is to find the most...read more

Ans.

Find the most frequent word in a paragraph that is not in the list of banned words.

  • Split the paragraph into words and convert them to uppercase for case-insensitivity.

  • Count the frequency of each word, excluding banned words.

  • Return the word with the highest frequency in uppercase.

Add your answer

Q14. Count Subarrays with Given XOR Problem Statement

You are given an array of integers ARR and an integer X. Your task is to determine the number of subarrays of ARR whose bitwise XOR is equal to X.

Example:

Input...read more
Ans.

Count the number of subarrays in an array whose XOR is equal to a given value.

  • Iterate through the array and keep track of XOR values and their frequencies using a hashmap.

  • For each element, calculate the XOR with the previous elements to find subarrays with XOR equal to the given value.

  • Use the hashmap to efficiently count the number of subarrays with the desired XOR value.

  • Handle edge cases like XOR value being 0 separately.

  • Time complexity can be optimized to O(N) using a hashm...read more

Add your answer

Q15. Stack using Two Queues Problem Statement

Develop a Stack Data Structure to store integer values using two Queues internally.

Your stack implementation should provide these public functions:

Explanation:

1. Cons...read more
Ans.

Implement a stack using two queues to store integer values with specified functions.

  • Use two queues to simulate stack operations efficiently.

  • Maintain the top element in one of the queues for easy access.

  • Ensure proper handling of edge cases like empty stack or invalid operations.

  • Example: Push elements 5, 10, 15; Pop element 15; Check top element 10; Check size of stack; Check if stack is empty.

Add your answer

Q16. Remove the Kth Node from the End of a Linked List

You are given a singly Linked List with 'N' nodes containing integer data and an integer 'K'. Your task is to delete the Kth node from the end of this Linked Li...read more

Ans.

Implement a function to remove the Kth node from the end of a singly linked list.

  • Traverse the list to find the length 'N' of the linked list.

  • Calculate the position of the node to be removed from the beginning as 'N - K + 1'.

  • Traverse the list again and remove the node at the calculated position.

Add your answer

Q17. LRU Cache Problem Statement

Design and implement a data structure for the Least Recently Used (LRU) Cache to efficiently support the following operations:

  1. get(key): Retrieve the value of the key if it exists i...read more
Ans.

Design and implement a data structure for LRU Cache to efficiently support get and put operations.

  • Implement a doubly linked list to maintain the order of recently used keys.

  • Use a hashmap to store key-value pairs for quick access.

  • Update the linked list and hashmap accordingly for get and put operations.

  • Discard the least recently used item when the cache reaches its capacity.

  • Handle edge cases like key not found in cache.

  • Example: Initialize cache with capacity 3, perform get and...read more

Add your answer

Q18. Populating Next Right Pointers in Each Node

Given a complete binary tree with 'N' nodes, your task is to determine the 'next' node immediately to the right in level order for each node in the given tree.

Input:...read more

Ans.

Implement a function to populate next right pointers in a complete binary tree.

  • Traverse the tree level by level using BFS

  • For each node, set its next pointer to the next node in the same level

  • Handle null nodes appropriately by setting next pointer to null

  • Ensure the tree is a complete binary tree to guarantee correct output

Add your answer

Q19. Pair Sum Problem Statement

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.

Note:

Each pa...read more

Ans.

Find pairs of elements in an array that sum up to a given value, sorted in a specific order.

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

  • If the complement exists, add the pair to the result list.

  • Sort the result list based on the criteria mentioned in the problem statement.

Add your answer

Q20. Longest Palindromic Substring Problem Statement

You are provided with a string STR of length N. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more

Ans.

Given a string, find the longest palindromic substring, choosing the one with the smallest start index if multiple exist.

  • Iterate through the string and expand around each character to find palindromes

  • Keep track of the longest palindrome found and its starting index

  • Return the longest palindromic substring with the smallest start index

Add your answer

Q21. Merge Two Sorted Linked Lists Problem Statement

You are provided with two sorted linked lists. Your task is to merge them into a single sorted linked list and return the head of the combined linked list.

Input:...read more

Ans.

Merge two sorted linked lists into a single sorted linked list without using additional space.

  • Create a dummy node to start the merged list

  • Compare the values of the two linked lists and append the smaller value to the merged list

  • Move the pointer of the merged list and the pointer of the smaller value's linked list

  • Continue this process until one of the linked lists is fully traversed

  • Append the remaining elements of the other linked list to the merged list

Add your answer

More about working at JPMorgan Chase & Co.

Top Rated Mega Company - 2024
Top Rated Company for Women - 2024
Top Rated Financial Services Company - 2024
HQ - New York, New York, United States (USA)
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Vertiv

based on 2 interviews
2 Interview rounds
Coding Test Round
Video Call Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Intern Interview Questions from Similar Companies

4.0
 • 66 Interview Questions
3.9
 • 46 Interview Questions
3.0
 • 35 Interview Questions
3.3
 • 18 Interview Questions
4.0
 • 16 Interview Questions
3.8
 • 12 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