Find Interview Questions for Top Companies
Ques:- Card shuffle problem. I have a card pack of 313 cards. I remove the topmost card from card pack and place it on desk and I remove the next one and put it below the pack of cards(that you are holding). keep doing this till all the cards are on desk…
Asked In :-
Right Answer:
The final order of the cards on the desk will be the cards in the following sequence: 1st, 3rd, 5th, ..., 313th, 2nd, 4th, 6th, ..., 312th. This means all odd-numbered cards will be placed first, followed by all even-numbered cards.
Ques:- A tree is serialized in such a way that all the leaves are market with L and all the other nodes with N. The tree is serialized keeping the order derived by a pre-order traversal. Write an algorithm for reconstructing the tree. Also, suggest a met…
Asked In :-
Right Answer:
To reconstruct the tree from the serialized string, you can use a recursive approach. Here’s a simple algorithm in Python:

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

def deserialize(data):
def helper():
nonlocal index
if index >= len(data):
return None

node_value = data[index]
index += 1

node = TreeNode(node_value)

if node_value == 'N': # Non-leaf node
node.left = helper()
node.right = helper()

return node

index = 0
return helper()

# Example usage:
# data = "N N L L N L L"
# root = deserialize(data.split())
```

This function reads the serialized string and reconstructs the tree based on the pre-order traversal format, where 'N' indicates a non-leaf node
Ques:- Given an sorted array, what is the complexity of finding weather a number is present n/2 times or not. a)O(lgn) b)O(n) c)O((lgn)^2) d)O(1)
Asked In :-
Right Answer:
a) O(lgn)
Ques:- Given a number, generate all the strings that can be obtained with that number on a telephone keypad
Asked In :-
Right Answer:
To generate all the strings that can be obtained from a number on a telephone keypad, you can use a backtracking approach. Here’s a simple Python function to achieve this:

```python
def letter_combinations(digits):
if not digits:
return []

phone_map = {
'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl',
'6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'
}

def backtrack(index, path):
if index == len(digits):
combinations.append("".join(path))
return
possible_letters = phone_map[digits[index]]
for letter in possible_letters:
path.append(letter)
backtrack(index + 1, path)
path.pop()

combinations = []
backtrack(0, [])
return combinations

# Example usage:
# print(letter
Ques:- There is a matrix of 1 and 0. 1 is a island and 0 is water. 1-1 together makes one island. calculate total no of islands
Asked In :-
Right Answer:
To calculate the total number of islands in a matrix of 1s and 0s, you can use Depth-First Search (DFS) or Breadth-First Search (BFS). Iterate through each cell in the matrix, and when you find a 1, increment the island count and perform a DFS/BFS to mark all connected 1s as visited (turn them into 0s). Continue this process until all cells are checked. The final count will be the total number of islands.
Ques:- Whats ArrayList in .Net (VB.Net or C#)What's the advantageous using ArrayList.
Asked In :-
Right Answer:
ArrayList in .NET is a collection class that can store a variable number of objects. It is part of the System.Collections namespace and allows for dynamic resizing. The advantages of using ArrayList include:

1. **Dynamic Sizing**: It can grow and shrink as needed, unlike arrays which have a fixed size.
2. **Flexibility**: It can store objects of different types, as it holds elements as objects.
3. **Easy to Use**: Provides methods for adding, removing, and searching for elements.

However, it's worth noting that for type safety and better performance, using generic collections like List<T> is often recommended over ArrayList.
Ques:- Imagine you have a special keyboard with the following keys:
Asked In :-
Right Answer:
Please provide the details of the special keyboard and the specific question you would like answered.
Ques:- Given an array of elements and an integer x, rearrange the array such that all the elements greater than or equal to x should be in descending order and all the elements less than x should be in ascending order in most efficient manner.
Asked In :-
Right Answer:
1. Separate the array into two lists: one for elements greater than or equal to x and another for elements less than x.
2. Sort the first list in descending order and the second list in ascending order.
3. Concatenate the two sorted lists to form the final rearranged array.
Ques:- Write a program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.
Asked In :-
Right Answer:
```python
from collections import Counter

def top_ten_frequent_words(file_path):
with open(file_path, 'r') as file:
text = file.read().lower()

words = text.split()
word_count = Counter(words)

most_common_words = word_count.most_common(10)

for word, freq in most_common_words:
print(f"{word}: {freq}")

# Example usage:
# top_ten_frequent_words('path_to_your_file.txt')
```
Ques:- WAP to count no of 1's occuring in a string? EX:if strinf is 1111 then it should return 4
Asked In :-
Right Answer:
```python
def count_ones(s):
return s.count('1')

# Example usage
result = count_ones("1111")
print(result) # Output: 4
```
Ques:- How to find if two arrays of size n are disjoint or not in O(n) time ?? You can use only O(n) space………… The elements are +ve in the range 0 to n power 100……….
Asked In :-
Right Answer:
To determine if two arrays of size n are disjoint in O(n) time using O(n) space, follow these steps:

1. Create a boolean array `hash` of size `n` initialized to `false`.
2. Iterate through the first array:
- For each element `arr1[i]`, set `hash[arr1[i]]` to `true`.
3. Iterate through the second array:
- For each element `arr2[j]`, check if `hash[arr2[j]]` is `true`.
- If it is, the arrays are not disjoint; return false.
4. If you finish checking all elements in the second array without finding a match, return true.

This approach ensures that you check for disjointness in O(n) time while using O(n) space for the boolean array.
Ques:- Find the k-th Smallest Element in the Union of Two Sorted Arrays
Asked In :-
Right Answer:
To find the k-th smallest element in the union of two sorted arrays, you can use a binary search approach. Here's a concise algorithm:

1. Let `A` and `B` be the two sorted arrays with lengths `m` and `n`, respectively.
2. Ensure that `m <= n` (if not, swap `A` and `B`).
3. Set `low = 0` and `high = m`.
4. While `low <= high`:
- Set `partitionA = (low + high) / 2`.
- Set `partitionB = k - partitionA`.
- Check the boundaries:
- If `partitionA > 0` and `A[partitionA - 1] > B[partitionB]`, move `high = partitionA - 1`.
- Else if `partitionA < m` and `B[partitionB - 1] > A[partitionA]`, move `
Ques:- Write prog to create skip list and search for nodes…
Asked In :-
Right Answer:
```python
import random

class Node:
def __init__(self, value, level):
self.value = value
self.forward = [None] * (level + 1)

class SkipList:
def __init__(self, max_level, p):
self.max_level = max_level
self.p = p
self.header = Node(None, max_level)
self.level = 0

def random_level(self):
level = 0
while random.random() < self.p and level < self.max_level:
level += 1
return level

def insert(self, value):
update = [None] * (self.max_level + 1)
current = self.header

for i in range(self.level, -1, -1):
while current.forward[i] and current.forward[i].value < value:
current = current.forward[i]
update[i] = current

current = current.forward
Ques:- I found this puzzle here http://shashank7s.blogspot.com/2011/07/my-design-problem-1-man-party-puzzle.html
Asked In :-
Right Answer:
To solve the Man Party Puzzle, the optimal solution is to have the man invite 3 women to the party. This way, he can ensure that at least one woman will be left alone with him at the end of the party, regardless of how the women pair off.
Ques:- A chessboard of size 64 blocks is given. a knight can move two n half moves at a time..how many steps will it take to cover all the 64 blocks…and change the algorithm if the knight moves three and a half moves.
Asked In :-
Right Answer:
A knight cannot cover all 64 blocks of a chessboard in a finite number of steps, regardless of whether it moves two and a half or three and a half moves at a time.
Ques:- Given millions of time intervals, compute the maximum weights and the time when maximum weights occurred.
Asked In :-
Right Answer:
To solve the problem of finding the maximum weights and the time when they occurred from millions of time intervals, you can use the following approach:

1. **Event Point Method**: Create an array of events for each time interval. For each interval, add an event for the start time (increasing weight) and an event for the end time (decreasing weight).

2. **Sort Events**: Sort the events by time. If two events have the same time, process the increase before the decrease.

3. **Sweep Line Algorithm**: Initialize a variable to keep track of the current weight and another to track the maximum weight and its corresponding time. Iterate through the sorted events:
- For each start event, increase the current weight.
- For each end event, decrease the current weight.
- After processing each event, check if the current weight exceeds the maximum weight. If it does, update the maximum weight and the time.

4. **Output**: At the end
Ques:- Convert a BST to a sorted doubly linked list in-place.
Asked In :-
Right Answer:
To convert a Binary Search Tree (BST) to a sorted doubly linked list in-place, you can use an in-order traversal. Here’s a concise implementation in Python:

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

class DoublyLinkedListNode:
def __init__(self, value=0):
self.value = value
self.prev = None
self.next = None

def bstToDoublyLinkedList(root):
if not root:
return None

head = None
prev = None

def inOrder(node):
nonlocal head, prev
if not node:
return

inOrder(node.left)

if prev:
prev.right = DoublyLinkedListNode(node.value)
prev.right.prev = prev
else:
head = Doubly
Ques:- Given a number 123456789 and two opearators + and *. You can use this two operators as many times u want. But you cant change the sequence of the number given there. The evaluated value is 2097.
Asked In :-
Right Answer:
123 + 456 + 789 = 1368
123 * 4 + 5 + 6 + 7 + 8 + 9 = 2097
So, the expression is: 123 * 4 + 5 + 6 + 7 + 8 + 9.
Ques:- Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square.
Asked In :-
Right Answer:
Here is a Python program that arranges numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square:

```python
import math

def is_perfect_square(n):
return int(math.sqrt(n)) ** 2 == n

def can_place(current, path):
if not path:
return True
return is_perfect_square(current + path[-1])

def arrange_numbers(n, path=[]):
if len(path) == n:
return path
for i in range(1, n + 1):
if i not in path and can_place(i, path):
result = arrange_numbers(n, path + [i])
if result:
return result
return None

result = arrange_numbers(16)
print(result)
```

This program will output a valid arrangement of numbers from 1 to 16 where the sum of two consecutive numbers is a perfect square.
Ques:- There are 8 characters and the probability of their occurrence is 1/2, 1/4, 1/81/256. How will u represent it in binary using minimum no. of bits ????
Asked In :- De Shaw,
Right Answer:
To represent the 8 characters with the given probabilities using the minimum number of bits, you can use the following binary representations:

1. Character with probability 1/2: 0
2. Character with probability 1/4: 10
3. Character with probability 1/8: 110
4. Character with probability 1/16: 1110
5. Character with probability 1/32: 11110
6. Character with probability 1/64: 111110
7. Character with probability 1/128: 1111110
8. Character with probability 1/256: 1111111

This way, you use a variable-length encoding based on the probabilities, ensuring that more frequent characters have shorter codes.


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