Join Regular Classroom : Visit ClassroomTech

UndosTres Overall Interview Questions – codewindow.in

Hot Topics

UdosTres Solution

Technical Round

Given an array of integers (both negative and positive), split this array such that sum of elements in each piece is equal. You have to find the total number of possible configurations.

The problem of splitting an array into pieces such that the sum of elements in each piece is equal is known as the Partition Problem. Unfortunately, the Partition Problem is NP-complete, meaning that finding the exact number of possible configurations is not possible in polynomial time for large arrays.
However, there are approximate algorithms and heuristics that can be used to find an approximate solution to this problem in a reasonable amount of time. One such algorithm is the Backtracking algorithm, which involves generating all possible partitions and checking if they have equal sums. Another approach is to use dynamic programming, which involves dividing the problem into subproblems and finding the solutions to these subproblems to obtain the solution to the original problem.
It’s also worth noting that there are some special cases where the exact number of possible configurations can be found in polynomial time. For example, if the array contains only non-negative integers, the problem can be solved using the Subset Sum Problem, which is solvable in polynomial time using dynamic programming.

Find the number of ways such that a binary strings can be divided in 3 segments such that s = s1 + s2 + s3. And each substr have same number of zeroes.

Given a binary string of length n, the number of ways to divide it into 3 segments such that each segment has the same number of zeroes can be determined by finding the number of ways to place 2 dividers in n-1 positions.
Let’s say the number of zeros in each segment is k. Then, n = 3k + 2 (since there are 2 dividers). The number of ways to place 2 dividers in n-1 positions is given by the binomial coefficient (n-1) choose 2, which can be calculated as (n-1)! / (2! * (n-3)!).
Thus, the number of ways to divide a binary string of length n into 3 segments with the same number of zeros is given by the sum of (n-1)! / (2! * (n-3)!) for all possible values of k.

Do you know about design patterns?

Yes, I am aware of design patterns. Design patterns are reusable solutions to common problems that arise in software design. They provide a way to structure code in a way that is flexible, maintainable, and easy to understand.
There are several types of design patterns, including creational patterns, structural patterns, and behavioral patterns. Some of the most commonly used design patterns include Singleton, Factory Method, Abstract Factory, Decorator, Facade, Observer, and State.
Each pattern has a specific purpose and can be used to solve a particular problem in software design. By using design patterns, developers can write more organized and maintainable code, and can also more easily communicate their design decisions to other members of the development team.

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories