Find Interview Questions for Top Companies
Ques:- You have 'n' players who have played against each other and for each player you have 2 sets Win = { } Loose = { } which tells you what all players has a given player lost/won against.
Asked In :- CPC Diagnostics,
Right Answer:
To determine the overall ranking of players based on their wins and losses, you can use a directed graph where each player is a node, and a directed edge from player A to player B indicates that A has won against B. You can then perform a topological sort on this graph to establish the ranking order. If there are cycles, it indicates that there are players with circular wins, which complicates the ranking. In such cases, additional methods like using a scoring system or pairwise comparisons may be needed to resolve ties.
Ques:- 3.Given two arrays with one array containing m elements sorted and another array of size m+n containing n elements sorted at beginning where the last m positions are empty, write code to merge these two sorted arrays efficiently so that u have the…
Asked In :-
Right Answer:
```python
def merge_sorted_arrays(arr1, arr2):
m = len(arr1)
n = len(arr2)

# Last index of arr1 and arr2
i = m - 1
j = n - 1
k = m + n - 1

# Merge in reverse order
while i >= 0 and j >= 0:
if arr1[i] > arr2[j]:
arr1[k] = arr1[i]
i -= 1
else:
arr1[k] = arr2[j]
j -= 1
k -= 1

# If there are remaining elements in arr2
while j >= 0:
arr1[k] = arr2[j]
j -= 1
k -= 1

# Example usage:
arr1 = [1, 3, 5, 0, 0, 0
Ques:- How do you apply Binary Search on 2D array supposed you have 2D array with integers sorted both horizontally and vertically. If you find any occurrence of the value you are looking for you return true else false. What is the complexity?For example the 2D
Asked In :-
Right Answer:
To apply binary search on a 2D array sorted both horizontally and vertically, start from the top-right corner of the array. Compare the target value with the current element:

1. If the current element equals the target, return true.
2. If the current element is greater than the target, move left (decrease the column index).
3. If the current element is less than the target, move down (increase the row index).

Repeat this process until you either find the target or go out of bounds of the array. If you exit the loop without finding the target, return false.

The time complexity of this approach is O(m + n), where m is the number of rows and n is the number of columns in the 2D array.
Ques:- Given a binary tree, write a program to find the cousin nodes of the given node.
Asked In :-
Right Answer:
To find the cousin nodes of a given node in a binary tree, follow these steps:

1. **Find the Level and Parent**: Perform a breadth-first search (BFS) to determine the level of the given node and its parent node.

2. **Collect Cousins**: During the BFS, collect all nodes at the same level as the given node but with a different parent.

Here is a Python implementation:

```python
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right

def find_cousins(root, target):
if not root:
return []

from collections import deque

queue = deque([(root, None)]) # (node, parent)
target_parent = None
target_level = 0
current_level = 0
cousins = []

while queue:
level_size =
Ques:- A rectangle is defined by two pts i.e, top left and bottom right . write a function that accepts four pts defining two rectangles and return whether they are intersecting or not!!!
Asked In :-
Right Answer:
```python
def do_rectangles_intersect(rect1, rect2):
# rect1 and rect2 are tuples of the form (top_left, bottom_right)
# where top_left and bottom_right are tuples of (x, y)

# Unpack the rectangles
(x1_min, y1_max), (x1_max, y1_min) = rect1
(x2_min, y2_max), (x2_max, y2_min) = rect2

# Check for intersection
if (x1_max < x2_min or x2_max < x1_min or
y1_min > y2_max or y2_min > y1_max):
return False
return True
```
Ques:- Write a function that would have as input a string,and list of characters to be deleted from the string. Write Test Cases.
Asked In :-
Right Answer:
```python
def remove_characters(input_string, chars_to_remove):
return ''.join(c for c in input_string if c not in chars_to_remove)

# Test Cases
print(remove_characters("hello world", ['h', 'e'])) # Output: "llo world"
print(remove_characters("abcdef", ['a', 'b', 'c'])) # Output: "def"
print(remove_characters("12345", ['1', '3', '5'])) # Output: "24"
print(remove_characters("openai", ['o', 'p'])) # Output: "enai"
print(remove_characters("", ['a', 'b'])) # Output: ""
```
Ques:- What is the BEST-WORST case time to add and remove elements from a queue that has been implemented with the help of 2 stacks.
Asked In :- secure meters,
Right Answer:
Best case: O(1)
Worst case: O(n)
Ques:- Write a func that will return second min weighted path between two nodes.(in linear time) Edge<list> find_sec( Node *n1, Node *n2, Edge<list> E2)
Asked In :-
Right Answer:
```cpp
#include <vector>
#include <limits>
#include <algorithm>

struct Node {
int id;
// Other properties
};

struct Edge {
Node* from;
Node* to;
int weight;
};

std::vector<Edge> find_sec(Node* n1, Node* n2, std::vector<Edge>& edges) {
std::vector<int> minWeights;
std::vector<Edge> paths;

for (const auto& edge : edges) {
if ((edge.from == n1 && edge.to == n2) || (edge.from == n2 && edge.to == n1)) {
minWeights.push_back(edge.weight);
paths.push_back(edge);
}
}

std::sort(minWeights.begin(), minWeights.end());
int secondMin = std::numeric_limits<int>::max();

for (const auto& weight : minWeights) {
if (weight > minWeights[0]) {
secondMin = std
Ques:- Twenty seven identical white cubes are assembled into a single cube, the outside of which is painted black. The cube is then disassembled and the smaller cubes are thoroughly shuffled in a bag.
Asked In :-
Right Answer:
The number of smaller cubes that have paint on them is 26.
Ques:- Implement the Color filling of MS-paint (when u click on an image.. all the pixels connected with the same color are filled with the choosen color). Given a matrix nXn having values of a color at each element.. try to implement the color filling w…
Asked In :-
Right Answer:
To implement the color filling algorithm (similar to the flood fill algorithm), you can use either Depth-First Search (DFS) or Breadth-First Search (BFS). Below is a simple implementation using DFS in Python:

```python
def flood_fill(matrix, x, y, new_color):
if matrix[x][y] == new_color:
return

original_color = matrix[x][y]
fill(matrix, x, y, original_color, new_color)

def fill(matrix, x, y, original_color, new_color):
if x < 0 or x >= len(matrix) or y < 0 or y >= len(matrix[0]):
return
if matrix[x][y] != original_color:
return

matrix[x][y] = new_color

fill(matrix, x + 1, y, original_color, new_color) # Down
fill(matrix, x - 1, y, original_color, new_color
Ques:- Given a new input string, how would you search a suffix array to find the longest match in the stored text? How would you build a GUI interface for this task?
Asked In :-
Right Answer:
To search a suffix array for the longest match of a new input string, follow these steps:

1. **Binary Search**: Use binary search on the suffix array to find the starting point where the input string could fit.
2. **Compare**: From the found position, compare the input string with the suffixes in the array to find the longest match.
3. **Track Length**: Keep track of the length of the longest match found during the comparisons.

For building a GUI interface for this task:

1. **Input Field**: Create a text box for users to enter the input string.
2. **Search Button**: Add a button to trigger the search operation.
3. **Display Area**: Include a section to display the longest match and its length.
4. **Feedback**: Provide visual feedback (like loading indicators) while searching.
5. **Error Handling**: Implement error messages for invalid inputs or no matches found.
Ques:- Given an histogram.. find out the maximum rectangle in it.. You are given the histogram as an array of heights of each bar.. find it in O(n)..
Asked In :-
Ques:- How to find the two numbers whose difference is minimum among the set of numbers ?? One solution is sort numbers and compare adjacent numbers to get minimum.. complexity O(nlogn).. Is there O(n) solution for this problem ??
Asked In :-
Ques:- How to generate the following series using recursion say for n(suppose n=4) print 4 3 2 1 2 3 4
Asked In :-
Ques:- Write code that implements Huffman Coding
Asked In :-
Ques:- Given two log files, each with a billion usernames (each username appended to the log file), find the usernames existing in both documents in the most efficient manner? Use pseudo-code or code. If your code calls pre-existing library functions, cr…
Asked In :-
Ques:- You have a fair coin. Make it unfair with win and loose probability p and (1-p) respectively, where p is greater than 0 less than 1 tryv to optimize asmuch as possible write maths behind this clearly
Asked In :-
Ques:- Given a set S, find all the maximal subsets whose sum <= k. For example, if S = {1, 2, 3, 4, 5} and k = 7 Output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4}
Asked In :-
Ques:- Given an array which has all the elements occuring thrice except one number which occurs only once. Find the number?
Asked In :- elv,


The Tech Architect section on takluu.com is dedicated to professionals aiming to lead the design and implementation of complex software systems. A Tech Architect plays a pivotal role in bridging business needs with technology solutions, ensuring that applications are scalable, maintainable, and aligned with organizational goals.

This category covers critical areas including system design principles, software architecture patterns (like microservices, SOA, MVC), cloud architecture, security best practices, API design, and performance optimization. You will also explore architecture documentation, stakeholder communication, and technology evaluation techniques.

Our content provides deep insights into both theoretical concepts and practical challenges faced by tech architects in real projects. Interview questions focus on problem-solving skills, architectural trade-offs, decision-making under constraints, and aligning technology stacks with business requirements.

Whether you’re preparing for roles like Technical Architect, Solution Architect, Enterprise Architect, or Lead Developer, this section equips you with the knowledge to explain complex designs clearly, defend your architectural choices, and demonstrate leadership in technology planning.

At Takluu, we combine detailed explanations with scenario-based questions and case studies to ensure you are ready for both technical and behavioral rounds in tech architect interviews. Our goal is to empower you to design robust solutions and take ownership of technology roadmaps confidently.

Prepare with us and take the next step in your career to become a successful Tech Architect who drives innovation and delivers impactful technology strategies.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users