Filter interviews by
Program to check if a binary tree is a BST
Traverse the tree in-order and check if the values are in ascending order
Use a min-max range for each node to check if it satisfies the BST property
Recursively check if the left and right subtrees are BSTs
Array is a collection of elements stored in contiguous memory locations while linked list is a collection of nodes linked by pointers.
Arrays have fixed size while linked lists can grow or shrink dynamically
Insertion and deletion is faster in linked lists than arrays
Accessing elements in arrays is faster than linked lists
Arrays are better for random access while linked lists are better for sequential access
A linked list is used to store and manipulate a collection of data elements in a linear order.
Linked lists are commonly used in computer science for implementing data structures like stacks, queues, and hash tables.
They are also used in operating systems for managing memory allocation.
For example, a linked list can be used to implement a music playlist where each song is a node and the links between nodes represen...
An array of key-value pairs is the best data structure for a dictionary.
Use a hash table or a balanced tree to implement the dictionary.
Keys should be unique and immutable.
Values can be any data type.
Access time should be O(1) or O(log n) depending on the implementation.
Examples: Python's dict, Java's HashMap, C++'s unordered_map.
Implement a stack using a linked list
Create a Node class with data and next pointer
Create a Stack class with top pointer
Push new nodes to the top of the stack
Pop nodes from the top of the stack
Check if the stack is empty before popping
BST stands for Binary Search Tree, a data structure used for efficient searching and sorting operations.
BST is a tree-like data structure where each node has at most two children.
The left child of a node contains a value less than the parent node, while the right child contains a value greater than the parent node.
BST allows for efficient searching and sorting operations with a time complexity of O(log n).
Examples...
Hashing is a technique to map data to a fixed-size table. Time complexity of searching a hash table is O(n) in worst case.
Hashing is used to store and retrieve data quickly
It uses a hash function to map data to a fixed-size table
In the best case, searching a hash table takes O(1) time
In the worst case, all the data maps to the same index and searching takes O(n) time
Collision resolution techniques like chaining an...
Array is a collection of elements stored in contiguous memory locations while linked list is a collection of nodes linked by pointers.
Arrays have fixed size while linked lists can grow or shrink dynamically
Insertion and deletion is faster in linked lists than arrays
Accessing elements in arrays is faster than linked lists
Arrays are better for random access while linked lists are better for sequential access
An array of key-value pairs is the best data structure for a dictionary.
Use a hash table or a balanced tree to implement the dictionary.
Keys should be unique and immutable.
Values can be any data type.
Access time should be O(1) or O(log n) depending on the implementation.
Examples: Python's dict, Java's HashMap, C++'s unordered_map.
Hashing is a technique to map data to a fixed-size table. Time complexity of searching a hash table is O(n) in worst case.
Hashing is used to store and retrieve data quickly
It uses a hash function to map data to a fixed-size table
In the best case, searching a hash table takes O(1) time
In the worst case, all the data maps to the same index and searching takes O(n) time
Collision resolution techniques like chaining and ope...
A linked list is used to store and manipulate a collection of data elements in a linear order.
Linked lists are commonly used in computer science for implementing data structures like stacks, queues, and hash tables.
They are also used in operating systems for managing memory allocation.
For example, a linked list can be used to implement a music playlist where each song is a node and the links between nodes represent the...
Implement a stack using a linked list
Create a Node class with data and next pointer
Create a Stack class with top pointer
Push new nodes to the top of the stack
Pop nodes from the top of the stack
Check if the stack is empty before popping
BST stands for Binary Search Tree, a data structure used for efficient searching and sorting operations.
BST is a tree-like data structure where each node has at most two children.
The left child of a node contains a value less than the parent node, while the right child contains a value greater than the parent node.
BST allows for efficient searching and sorting operations with a time complexity of O(log n).
Examples of a...
Program to check if a binary tree is a BST
Traverse the tree in-order and check if the values are in ascending order
Use a min-max range for each node to check if it satisfies the BST property
Recursively check if the left and right subtrees are BSTs
Top trending discussions
Endianess refers to the order in which bytes are stored in memory. Little endian stores the least significant byte first.
Check the byte order of a multi-byte integer value
Use a test value with known byte order to determine the system's endianess
Check the system's documentation or specifications
Use a code snippet to determine the endianess
Function pointers can be shared across processes using inter-process communication mechanisms like shared memory, pipes, sockets, etc.
Function pointers can be stored in shared memory regions that are accessible by multiple processes.
Processes can communicate with each other using pipes or sockets and pass function pointers as arguments.
Remote Procedure Call (RPC) mechanisms can also be used to share function pointers a...
Binder is a mechanism for inter-process communication in Android.
Binder allows different processes to communicate with each other.
It is used for implementing Android's IPC (Inter-Process Communication) system.
Binder uses a client-server model where the client sends requests to the server and the server responds with the requested data.
It is used for sharing data between different components of an Android application.
Bi...
sysctrl is a system control utility used to manage system settings and configurations.
sysctrl is used to manage system settings and configurations such as network settings, power management, and hardware configurations.
It can be used to start, stop, and restart system services.
sysctrl is commonly used in Linux and Unix-based operating systems.
Examples of sysctrl commands include 'sysctrl -p' to reload all settings from...
Device tree is a data structure used to describe hardware components in a system and their interconnections.
Device tree is used in embedded systems to provide a standardized way of describing hardware components.
It is written in a language called Device Tree Source (DTS) and compiled into a binary format called Device Tree Blob (DTB).
The device tree is loaded by the bootloader and used by the kernel to configure the ha...
4 IPCs used in user level process in Linux
Message Queues - allows processes to exchange data through messages
Shared Memory - allows processes to share a portion of memory
Semaphores - used for synchronization between processes
Pipes - allows communication between two related processes
Inter-process communication mechanisms like pipes, sockets, message queues, shared memory can be used to call a function from one user process to another.
Use pipes to establish a unidirectional communication channel between two processes.
Use sockets to establish a bidirectional communication channel between two processes.
Use message queues to send messages between processes.
Use shared memory to share data between proce...
Program with 2 threads printing even and odd numbers in sequence. How to make it SMP safe?
Use mutex locks to ensure only one thread accesses the shared resource (the number to be printed) at a time
Use condition variables to signal when it's safe for the other thread to access the shared resource
Use atomic variables to ensure that the shared resource is accessed atomically
Use thread-safe data structures to store the sha...
Medium difficulty level of questions
Reversing a linked list involves changing the direction of the pointers between nodes.
Initialize three pointers: prev, current, and next.
Set prev to null and current to the head of the list.
Iterate through the list: update next to current.next, current.next to prev, then move prev and current forward.
Continue until current is null, then set the head to prev.
Example: For list 1 -> 2 -> 3, after reversal it becomes...
The Two-Sum Problem involves finding two numbers in an array that add up to a specific target sum.
Given an array of integers and a target sum, identify two numbers that sum to the target.
Example: For array [2, 7, 11, 15] and target 9, the answer is indices 0 and 1 (2 + 7 = 9).
Use a hash map to store numbers and their indices for efficient lookup.
Time complexity is O(n) with a single pass through the array.
posted on 7 May 2017
I appeared for an interview in Feb 2017.
malloc is a function in C that dynamically allocates memory on the heap. It is used to allocate memory for variables or data structures.
malloc is used in C programming language.
It is used to allocate memory on the heap.
malloc is different from 'new' in C++ as it does not call constructors for objects.
C++ is a general-purpose programming language while Objective C is a superset of C used for iOS and macOS development.
C++ is widely used for developing applications, games, and system software.
Objective C is mainly used for iOS and macOS development.
C++ supports both procedural and object-oriented programming paradigms.
Objective C is an object-oriented language with dynamic runtime features.
C++ has a larger community a...
Class container is a class that holds objects of other classes, while class composition is a way to combine multiple classes to create a new class.
Class container holds objects of other classes, acting as a collection or container.
Class composition combines multiple classes to create a new class with its own behavior and attributes.
In class container, the objects are typically stored in a data structure like an array o...
Divide the horses into groups of 5 and race them. Take the top 2 from each race and race them again. Finally, race the top 2 horses to determine the top 3.
Divide the horses into 3 groups of 5 and race them.
Take the top 2 horses from each race and race them again.
Finally, race the top 2 horses to determine the top 3.
Developing a real-time data processing system for a high-traffic e-commerce website
Implemented a distributed system architecture to handle large volumes of data
Optimized algorithms for efficient data processing and storage
Utilized caching mechanisms to improve system performance
Worked closely with cross-functional teams to troubleshoot and resolve issues
Example: Successfully reduced data processing time by 50% by imple...
Seeking new challenges and opportunities for growth.
Looking for a more challenging role to further develop my skills
Interested in exploring new technologies and industries
Seeking better career advancement opportunities
Want to work in a more collaborative team environment
The width of a tree is the maximum number of nodes at any level in the tree.
To calculate the width of a tree, we can perform a level order traversal and keep track of the maximum number of nodes at any level.
We can use a queue data structure to perform the level order traversal.
At each level, we count the number of nodes in the queue and update the maximum width if necessary.
I appeared for an interview in Aug 2017.
posted on 10 May 2015
Locate sum of 2 numbers in a linear array (unsorted and sorted) and their complexities
For unsorted array, use nested loops to compare each element with every other element until the sum is found
For sorted array, use two pointers approach starting from the beginning and end of the array and move them towards each other until the sum is found
Complexity for unsorted array is O(n^2) and for sorted array is O(n)
Pointers are used to manipulate memory addresses and values in C++. Increment/decrement, address of and value at operators are commonly used.
Incrementing a pointer moves it to the next memory location of the same data type
Decrementing a pointer moves it to the previous memory location of the same data type
The address of operator (&) returns the memory address of a variable
The value at operator (*) returns the value sto...
To determine if a point is inside or outside a rectangle, we check if the point's coordinates fall within the rectangle's boundaries.
Check if the point's x-coordinate is greater than the left edge of the rectangle
Check if the point's x-coordinate is less than the right edge of the rectangle
Check if the point's y-coordinate is greater than the top edge of the rectangle
Check if the point's y-coordinate is less than the b...
To find line that divides rectangle into 2 equal halves through a point inside it.
Find the center of the rectangle
Draw a line from the center to the given point
Extend the line to the opposite side of the rectangle
The extended line will divide the rectangle into 2 equal halves
There are multiple combinations of 8-bit and 16-bit signed numbers. How many such combinations are possible?
There are 2^8 (256) possible combinations of 8-bit signed numbers.
There are 2^16 (65,536) possible combinations of 16-bit signed numbers.
To find the total number of combinations, we can add the number of combinations of 8-bit and 16-bit signed numbers.
Therefore, the total number of possible combinations is 256 + ...
Find duplicates in an array of elements in 0(n) time and 0(1) space.
Use the property of inputs to your advantage
Iterate through the array and mark elements as negative
If an element is already negative, it is a duplicate
Return all the negative elements as duplicates
Generate all combinations of digits from an array, allowing and disallowing repetition.
Use recursion or backtracking to generate combinations.
For repetition allowed: e.g., arr={1,2}, combinations are 11, 12, 21, 22.
For repetition not allowed: e.g., arr={1,2,3}, combinations are 123, 132, 213, 231, 312, 321.
Utilize a set to track used digits when repetition is not allowed.
I appeared for an interview in Aug 2017.
I lack experience in a specific technology required for the role.
I may not have experience with a specific programming language or framework mentioned in the job description.
I may not have worked on projects similar to what your company is working on.
I may not have experience with certain tools or technologies that are crucial for the role.
I appeared for an interview before May 2016.
Technical Lead
284
salaries
| ₹11 L/yr - ₹47 L/yr |
Senior Software Engineer
133
salaries
| ₹10 L/yr - ₹34 L/yr |
Software Engineer
102
salaries
| ₹6.6 L/yr - ₹26.2 L/yr |
Manufacturing Engineer
98
salaries
| ₹5 L/yr - ₹16 L/yr |
Senior Engineer Mechanical
73
salaries
| ₹8.4 L/yr - ₹18 L/yr |
Qualcomm
Intel
Molex
TDK India Private Limited