BNY Mellon is a huge financial company that operates all over the world and has more than 50,000 employees. They have various technical job openings in areas like software development, data analysis, and IT systems.

When you have a technical job interview at BNY Mellon, it can be tough, but if you prepare well, you can improve your chances of doing well. This article has a list of common technical questions they might ask you during the interview and provides answers. The questions cover topics like Object-Oriented Programming, Java, C++, and Database Management Systems. Reading this article will help you know what to expect in the interview and get ready to answer their questions.

**1. ****Minimum number of given operations required to convert a permutation into an identity permutation**** Approach:** First, find all the cycles in the given permutation. Here, a cycle is a directed graph in which there is an edge from an element e to the element on position e.

** For example, **Here’s the graph for permutation {4, 6, 5, 3, 2, 1, 8, 7}

Now in one operation, each cycle of length 3k breaks into 3 cycles each of length k while cycles of length 3k+1 or 3k+2 do not break. Since in the end, we need all cycles of length 1, all cycles must be a power of 3 otherwise answer doesn’t exist. The answer would then be the maximum log(base 3) of all cycle lengths.

**2. ****Convert an array into a Zig-Zag fashion**

After sorting, exclude the first element, and swap the remaining elements in pairs. (i.e. keep arr[0] as it is, swap arr[1] and arr[2], swap arr[3] and arr[4], and so on).

**3. ****Kadane’s Algorithm**

The idea of Kadane’s algorithm is to maintain a variable max_ending_here that stores the maximum sum of contiguous subarray ending at the current index and a variable max_so_far stores the maximum sum of contiguous subarray found so far, Everytime there is a positive-sum value in max_ending_here compare it with max_so_far and update max_so_far if it is greater than max_so_far.

**4. ****Given a sequence of words, print all anagrams together**

A simple method is to create a Hash Table. Calculate the hash value of each word in such a way that all anagrams have the same hash value. Populate the Hash Table with these hash values. Finally, print those words together with the same hash values. A simple hashing mechanism can be modulo the sum of all characters. With modulo sum, two non-anagram words may have the same hash value. This can be handled by matching individual characters.

**5. ****Alien Dictionary**

The idea is to create a directed graph where each character represents a node, and edges between nodes indicate the relative order of characters. If the graph created contains a cycle then a valid order of characters is not possible the topological sorting algorithm is applied to the graph to determine the character order.

**6. ****Rotten Oranges**

The idea is to use Breadth First Search. The condition of oranges getting rotten is when they come in contact with other rotten oranges. This is similar to a breadth-first search where the graph is divided into layers or circles and the search is done from lower or closer layers to deeper or higher layers.

In the previous approach, the idea was based on BFS but the implementation was poor and inefficient. To find the elements whose values are no the whole matrix had to be traversed. So time can be reduced by using this efficient approach of BFS.

**Q7. ****Circle of strings**

The idea is to create a directed graph of all characters and then find if there is an Eulerian circuit in the graph or not.

**8. ****N-Queen Problem**

The idea is to place queens one by one in different columns, starting from the leftmost column. When we place a queen in a column, we check for clashes with already placed queens. In the current column, if we find a row for which there is no clash, we mark this row and column as part of the solution. If we do not find such a row due to clashes, then we backtrack and return false.

**9. ****Nth node from the end of the linked list**

As the Nth node from the end equals to (Length – N + 1)th node from the start, so the idea is to Maintain two pointers starting from the head of the Linked List and move one pointer to the Nth node from the start and then move both the pointers together until the pointer at the Nth position reaches the last node. Now the pointer which was moved later points at the Nth node from the end of the Linked-List

**10. ****Minimum Spanning Tree**

In Kruskal’s algorithm, sort all edges of the given graph in increasing order. Then it keeps on adding new edges and nodes in the MST if the newly added edge does not form a cycle. It picks the minimum weighted edge at first and the maximum weighted edge at last.

**11. ****Find kth smallest element in given n ranges**

The idea is to first Prerequisite: Merge Overlapping Intervals and keep all intervals sorted in ascending order of start time. After merging in an array [], we use linear search to find kth smallest element.

**12. ****Matrix Chain Multiplication**

Two matrices of size m*n and n*p when multiplied, generate a matrix of size m*p and the number of multiplications performed is m*n*p.

Now, for a given chain of N matrices, the first partition can be done in N-1 ways. For example, the sequence of matrices A, B, C, and D can be grouped as (A)(BCD), (AB)(CD) or (ABC)(D) in these 3 ways.

So a range [i, j] can be broken into two groups like {[i, i+1], [i+1, j]}, {[i, i+2], [i+2, j]}, . . . , {[i, j-1], [j-1, j]}.

- Each of the groups can be further partitioned into smaller groups and we can find the total required multiplications by solving for each of the groups.
- The minimum number of multiplications among all the first partitions is the required answer.

**13. ****Power of 2**

A simple method for this is to simply take the log of the number on base 2 and if you get an integer then the number is the power of 2

**14. ****Flattening a Linked List**

The idea is to use the Merge() process of merge sort for linked lists. Use merge() to merge lists one by one, and recursively merge() the current list with the already flattened list. The down pointer is used to link nodes of the flattened list.

**15. ****Level order traversal**

Level Order Traversal technique is defined as a method to traverse a Tree such that all nodes present in the same level are traversed completely before traversing the next level.

**16. ****DFS traversal of a Tree**

DFS (Depth-first search) is a technique used for traversing trees or graphs. Here backtracking is used for traversal. In this traversal first, the deepest node is visited and then backtracks to its parent node if no sibling of that node exists

**17. ****Right View of Binary Tree**

The idea is to use recursion and keep track of the maximum level also. And traverse the tree in a manner that the right subtree is visited before the left subtree.

**18. ****Largest rectangular sub-matrix whose sum is 0**

The solution is based on a __ Maximum sum rectangle in a 2D matrix__. The idea is to reduce the problem to 1 D array. We can use Hashing to find the maximum length of sub-array in a 1-D array in O(n) time. We fix the left and right columns one by one and find the largest sub-array with 0 sum contiguous rows for every left and right column pair. We basically find top and bottom row numbers (which have a sum is zero) for every fixed left and right column pair.

To find the top and bottom row numbers, calculate the sum of elements in every row from left to right and store these sums in an array say, temp[]. So temp[i] indicates the sum of elements from left to right in row i. If we find the largest subarray with 0 sum on temp, and no. of elements is greater than the previous no. of elements then update the values of final row_up, final row_down, final col_left, and final col_right.

**19. ****Sort a stack**

The idea of the solution is to hold all values in the Function Call Stack until the stack becomes empty. When the stack becomes empty, insert all held items one by one in sorted order. and then print the stack

**20. ****Replace O’s with X’s**

This is mainly an application of the __Flood-Fill algorithm__. The main difference here is that a ‘O’ is not replaced by ‘X’ if it lies in a region that ends on a boundary. Following are simple steps to do this special flood fill.

- Traverse the given matrix and replace all ‘O’ with a special character ‘-‘.
- Traverse four edges of a given matrix and call
__floodFill(‘-‘, ‘O’)__for every ‘-‘ on edges. The remaining ‘-‘ are the characters that indicate ‘O’s (in the original matrix) to be replaced by ‘X’. - Traverse the matrix and replace all ‘-‘s with ‘X’s.

**21. ****Word Break**** Recursive implementation: **The idea is simple, we consider each prefix and search for it in the dictionary. If the prefix is present in the dictionary, we recur for the rest of the string (or suffix).

**22. ****Unique BST’s**

The solution is based on** **__Dynamic Programming__. For all possible values of i, consider i as root, then [1 . . . i-1] numbers will fall in the left subtree and [i+1 . . . N] numbers will fall in the right subtree.

The count of all possible BST’s will be ** count(N) = summation of (count(i-1)*count(N-i)) **where

**lies in the range**

**i****.**

**[1, N]****23. ****Jump Game**

Start from the first element and recursively call for all the elements reachable from the first element. The minimum number of jumps to reach end from first can be calculated using the minimum value from the recursive calls.

** minJumps(start, end) = 1 + Min(minJumps(k, end)) **for all k reachable from start.

**24. ****Difference between Structure and Array in C****, ****Array in C**

An array is a collection of items stored at contiguous memory locations.

A structure is a user-defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.

**25. ****Difference between SQL and NoSQL**

SQL |
NoSQL |
---|---|

RELATIONAL DATABASE MANAGEMENT SYSTEM (RDBMS) | Non-relational or distributed database system. |

These databases have fixed or static or predefined schema | They have a dynamic schema |

These databases are not suited for hierarchical data storage. | These databases are best suited for hierarchical data storage. |

These databases are best suited for complex queries | These databases are not so good for complex queries |

**26. ****ACID Properties in DBMS**

A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database. Transactions access data using read-and-write operations.

In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.

**27. ****Types of Keys in Relational Model (Candidate, Super, Primary, Alternate, and Foreign)**

Keys are one of the basic requirements of a relational database model. It is widely used to identify the tuples(rows) uniquely in the table. We also use keys to set up relations amongst various columns and tables of a relational database.

**28. ****Database Normalization**

In database management systems (DBMS), normal forms are a series of guidelines that help to ensure that the design of a database is efficient, organized, and free from data anomalies. There are several levels of normalization, each with its own set of guidelines, known as normal forms.

**29. ****Encapsulation in C++**

Consider a real-life example of encapsulation, in a company, there are different sections like the accounts section, finance section, sales section, etc. Now,

- The finance section handles all the financial transactions and keeps records of all the data related to finance.
- Similarly, the sales section handles all the sales-related activities and keeps records of all the sales.

**30.****C++ Polymorphism**

The word “polymorphism” means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.

Types of Polymorphism

- Compile-time Polymorphism
- Runtime Polymorphism

**31. ****What is a Thread?**

A thread is a single sequence stream within a process. Because threads have some of the properties of processes, they are sometimes called lightweight processes. Threads are a popular way to improve the application through parallelism.

**32.****What are the differences between process and thread?**

Process |
Thread |
---|---|

Process means any program is in execution. | Thread means a segment of a process. |

The process takes more time to terminate. | The thread takes less time to terminate. |

It takes more time for creation. | It takes less time for creation. |

It also takes more time for context switching. | It takes less time for context switching. |

The process is less efficient in terms of communication. | Thread is more efficient in terms of communication. |

**33.****What is caching?**

It is the process of storing and accessing data from memory(i.e. cache memory). The main feature of caching is to reduce the time to access specific data. Caching aims at storing data that can be helpful in the future. The reason for caching is that accessing the data from persistent memory(hard drives like HDD, SDD) used to take considerable time, thus, slowing the process.

**34.****What is a Firewall?**

A firewall is a network security device, either hardware or software-based, which monitors all incoming and outgoing traffic and based on a defined set of security rules it accepts, rejects or drops that specific traffic.

**35.****Differences between IPv4 and IPv6**

IPv4 |
IPv6 |
---|---|

IPv4 has a 32-bit address length | IPv6 has a 128-bit address length |

It Supports Manual and DHCP address configuration | It supports Auto and renumbering address configuration |

In IPv4 end to end, connection integrity is Unachievable | In IPv6 end-to-end, connection integrity is Achievable |

It can generate 4.29×10^{9} address space |
The address space of IPv6 is quite large it can produce 3.4×10^{38} address space |

The Security feature is dependent on the application | IPSEC is an inbuilt security feature in the IPv6 protocol |

: To check the BNY Mellon and other asked question go through the attached linkP.S