HashedIn by Deloitte
100+ Gabriel India Interview Questions and Answers
Q1. Chocolate Pickup Problem
Ninja has a 'GRID' of size 'R' x 'C'. Each cell of the grid contains some chocolates. Ninja has two friends, Alice and Bob, and he wants to collect as many chocolates as possible with t...read more
Q2. Reverse the Linked List
Given a singly linked list of integers, your task is to return the head of the reversed linked list.
Input:
The first line of input contains an integer 'T' representing the number of tes...read more
Q3. Maximum Subarray Sum Problem Statement
Given an array arr
of length N
consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.
Explanation:
A sub...read more
Q4. Find K'th Character of Decrypted String
You are given an encrypted string where repeated substrings are represented by the substring followed by its count. Your task is to find the K'th character of the decrypt...read more
Q5. Leaders in an Array Problem Statement
Given a sequence of numbers, the task is to identify all the leaders within this sequence. An element is considered a leader if it is strictly greater than all the elements...read more
Q6. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Q7. Lowest Common Ancestor in a BST Problem Statement
You're provided with a Binary Search Tree (BST) containing 'N' nodes with integer values and two specific nodes, 'P' and 'Q'.
Your task is to identify the lowes...read more
Q8. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
Q9. Trailing Zeros in Factorial Problem
Find the number of trailing zeroes in the factorial of a given number N
.
Input:
The first line contains an integer T
representing the number of test cases.
Each of the followi...read more
Q10. Find Two Missing Numbers Problem Statement
Given an array of unique integers where each element is in the range [1, N], and the size of the array is (N - 2), there are two numbers missing from this array. Your ...read more
Q11. Longest Increasing Subsequence Problem Statement
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more
Q12. Merge K Sorted Arrays Problem Statement
Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.
Input
The f...read more
Q13. Convert Binary Tree to Mirror Tree Problem Statement
Given a binary tree, convert this binary tree into its mirror tree. A binary tree is a tree in which each parent node has at most two children. The mirror of...read more
Q14. Min Jumps Problem Statement
In Ninja town, represented as an N * M
grid, people travel by jumping over buildings in the grid's cells. Santa is starting at cell (0, 0) and must deliver gifts to cell (N-1, M-1) o...read more
Q15. Check if Two Trees are Mirror
Given two arbitrary binary trees, your task is to determine whether these two trees are mirrors of each other.
Explanation:
Two trees are considered mirror of each other if:
- The r...read more
Q16. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
Q17. Convert a Number to Words
Given an integer number num
, your task is to convert 'num' into its corresponding word representation.
Input:
The first line of input contains an integer ‘T’ denoting the number of tes...read more
Q18. Sort 0 1 2 Problem Statement
Given an integer array arr
of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.
Input:
The first line contains an integer 'T' representing the number of...read more
Q19. Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more
Q20. Triplets with Given Sum Problem
Given an array or list ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a specified number K
.
Explanation:
A triplet i...read more
Q21. Anagram Pairs Verification Problem
Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more
Q22. Longest Mountain Subarray Problem Statement
Given an array of integers denoting the heights of the mountains, find the length of the longest subarray that forms a mountain shape.
A mountain subarray is defined ...read more
Q23. Cycle Detection in a Singly Linked List
Determine if a given singly linked list of integers forms a cycle or not.
A cycle in a linked list occurs when a node's next
points back to a previous node in the list. T...read more
Q24. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
Q25. Container With Most Water Problem Statement
Given a sequence of ‘N’ non-negative integers, A[1], A[2], ..., A[i], ..., A[N]
, where each number represents the height of a vertical line drawn at position 'i'. On ...read more
Q26. Group Anagrams Problem Statement
Given an array or list of strings called inputStr
, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one another.
An...read more
Q27. String Palindrome Verification
Given a string, your task is to determine if it is a palindrome considering only alphanumeric characters.
Input:
The input is a single string without any leading or trailing space...read more
Q28. Increase Number By 1 Problem Statement
Given an array of integers NUM
that consists of N
elements, where the array represents the digits of a number, your task is to add 1 to this number. The number is positive...read more
Q29. Four Sum Problem Statement
You are provided with an array/list 'ARR' consisting of 'N' integers and an integer 'TARGET'. The task is to determine if there exist four distinct numbers in 'ARR' such that their su...read more
Q30. Lowest Common Ancestor (LCA) Problem Statement
Understanding the concept of Lowest Common Ancestor (LCA) in graph theory and computer science is essential.
Consider a rooted tree ‘T’ containing ‘N’ nodes. The L...read more
Q31. Tic-Tac-Toe Design Problem
Design a 2-player Tic-Tac-Toe game played on an N
* N
grid where Player 1 uses ‘X’ and Player 2 uses ‘O’. A move is always valid and occupies an empty spot.
If a player places N
of th...read more
Q32. Remove Duplicates from String Problem Statement
You are provided a string STR
of length N
, consisting solely of lowercase English letters.
Your task is to remove all duplicate occurrences of characters in the s...read more
Q33. Minimum Count of Balls in a Bag Problem Statement
You are given an integer array ARR
of size N
, where ARR[i]
represents the number of balls in the i-th
bag. Additionally, you have an integer M
, which indicates ...read more
Q34. Excel Column Number Conversion
Given a column title as it appears in an Excel sheet, your task is to return its corresponding column number.
Example:
Input:
S = "AB"
Output:
28
Explanation:
The sequence is as f...read more
Q35. Last Stone Weight Problem Statement
We have a set collection of N
stones, and each stone has a given positive integer weight. On each turn, select the two stones with the maximum weight and smash them together....read more
Q36. Find Duplicate in Array Problem Statement
You are provided with an array of integers 'ARR' consisting of 'N' elements. Each integer is within the range [1, N-1], and the array contains exactly one duplicated el...read more
Q37. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Q38. Convert Binary Tree to Mirror Tree
Convert a given binary tree into its mirror tree, where the left and right children of all non-leaf nodes are interchanged.
Input:
An integer ‘T’ denoting the number of test c...read more
Q39. Optimize the code for job scheduling written in the first round
Optimize job scheduling code
Use priority queue to efficiently schedule jobs
Implement dynamic programming to optimize job sequence
Consider parallel processing to reduce overall time
Use efficient data structures to store job information
Q40. Binary Palindrome Check
Given an integer N
, determine whether its binary representation is a palindrome.
Input:
The first line contains an integer 'T' representing the number of test cases.
The next 'T' lines e...read more
Q41. Palindrome Permutation - Problem Statement
Determine if a permutation of a given string S
can form a palindrome.
Example:
Input:
string S = "aab"
Output:
"True"
Explanation:
The permutation "aba" of the string ...read more
Q43. Write code to find max length subarray matching the given sum
Code to find max length subarray matching the given sum
Use a sliding window approach to iterate through the array
Keep track of the current sum and the maximum length subarray
If the current sum exceeds the given sum, move the window's left pointer
If the current sum matches the given sum, update the maximum length subarray
Return the maximum length subarray
Q46. Optimize the code for generating prime numbers
Use Sieve of Eratosthenes algorithm to optimize prime number generation.
Implement Sieve of Eratosthenes algorithm to eliminate non-prime numbers
Use boolean array to mark non-prime numbers
Start with 2 and mark all its multiples as non-prime, then move to next unmarked number
Stop at square root of the upper limit to optimize performance
Q47. Write an SQL query to given an output from given tables
SQL query to retrieve output from given tables
Identify the tables and their relationships
Determine the columns to be selected
Use appropriate join and filter conditions
Group and aggregate data if required
Q48. What is CRFS? The experience around working with it.
CRFS stands for Continuous Randomized Feedback System. It is a method used in clinical trials to collect data from patients.
CRFS is a way to collect data from patients in clinical trials in real-time.
It involves randomizing questions and collecting feedback from patients at various intervals.
The data collected through CRFS can help researchers make informed decisions about the efficacy of a treatment.
CRFS can be implemented through various methods such as mobile apps, web-bas...read more
Q49. Architecture Design for an e2e system that takes input from user to the response shown to the user
An e2e system architecture design for user input to response output
Identify user requirements and define system goals
Choose appropriate technologies and frameworks
Design system components and their interactions
Ensure scalability, reliability, and security
Test and validate the system before deployment
Q50. Give a solution to store newspapers of a company
Store newspapers of a company
Create a database to store newspaper information
Use a unique identifier for each newspaper
Include fields for date, title, author, and content
Implement a search function for easy retrieval
Consider implementing a backup system for data security
Q51. Aws services and how to create and launch EC2 instances
AWS services include EC2 for virtual servers. To create and launch EC2 instances, use the AWS Management Console, CLI, or SDK.
Access the AWS Management Console and navigate to the EC2 dashboard
Click on 'Launch Instance' to choose an Amazon Machine Image (AMI), instance type, and configure instance details
Review and launch the instance, selecting key pair for SSH access
Use AWS CLI or SDK to create and launch EC2 instances programmatically
Q52. Designing of APIs, SQL query to find second largest value
Designing APIs and finding second largest value in SQL query.
For API design, consider RESTful principles and use clear and concise naming conventions.
For finding second largest value in SQL, use ORDER BY and LIMIT clauses.
Consider edge cases such as duplicates and null values.
Test thoroughly to ensure correct functionality.
Q53. What is difference between Python and Node.JS?
Python is a general-purpose language while Node.JS is a JavaScript runtime environment.
Python is used for web development, data analysis, artificial intelligence, and scientific computing.
Node.JS is used for building scalable network applications and real-time web applications.
Python is slower than Node.JS in terms of performance.
Python has a larger standard library than Node.JS.
Python is easier to learn and has a simpler syntax than Node.JS.
Q54. What is the difference between SQL and NoSQL?
SQL is a relational database management system while NoSQL is a non-relational database management system.
SQL databases are table-based while NoSQL databases are document-based, key-value pairs, graph databases, or column-based.
SQL databases are structured while NoSQL databases are unstructured.
SQL databases use SQL (Structured Query Language) for querying and managing data while NoSQL databases use different query languages like MongoDB uses JSON-like documents.
SQL databases...read more
Q55. Implement a min stack using a single stack
Implement a min stack using a single stack
Create a stack to hold the elements and another stack to hold the minimum values
When pushing an element, check if it's smaller than the current minimum and push it to the minimum stack if it is
When popping an element, check if it's the current minimum and pop it from the minimum stack if it is
To get the minimum value, return the top element of the minimum stack
Q56. Monolith vs Microservices difference? which is better and why?
Monolith is a single, large application while microservices are smaller, independent services. Microservices are better for scalability and flexibility.
Monolith is a single, large application where all components are tightly coupled. Microservices are smaller, independent services that communicate with each other through APIs.
Monoliths are easier to develop and deploy initially but become harder to maintain and scale as they grow. Microservices allow for better scalability an...read more
Q57. 1. Describe your projects in depth. 2. Database schema design of Codechef. 3. SQL queries related to that. 4. Questions on CN
Answering questions on projects, database schema design of Codechef, SQL queries, and CN.
Projects involved developing a web application for managing employee data and a mobile app for tracking expenses.
Database schema design of Codechef involved creating tables for users, problems, submissions, and contests.
SQL queries related to Codechef included retrieving user details, problem submissions, and contest rankings.
Questions on CN covered topics such as network protocols, OSI m...read more
Q59. Q1 - Pre order traversal without recursion. Q2 - Reverse a linked list.
Q1 - Pre order traversal without recursion. Q2 - Reverse a linked list.
Q1: Use a stack to keep track of nodes. Start with root, push it to stack. Pop top node, print it, push right and left children to stack.
Q2: Traverse the linked list and change the direction of the pointers. Set the head of the reversed list as the last node of the original list.
Q60. Write CLI snake and ladders game code
CLI snake and ladders game code
Create a board with 100 cells using a 10x10 array
Define snakes and ladders positions as an array of tuples
Use a loop to alternate player turns and move them based on dice roll
Check for snakes and ladders and update player position accordingly
Print the board after each turn and declare winner when a player reaches cell 100
Q62. Q1 - Sort the string according to frequency of characters
Sort a string based on the frequency of its characters.
Create a hash table to store the frequency of each character.
Sort the characters based on their frequency using a sorting algorithm.
Reconstruct the string based on the sorted characters and their frequency.
Q63. Difference between a semaphore and mutex
Semaphore is used to control access to a resource with limited capacity while mutex is used to synchronize access to a shared resource.
Semaphore allows multiple threads to access a resource simultaneously up to a certain limit while mutex allows only one thread to access a shared resource at a time.
Semaphore can be used to solve the producer-consumer problem while mutex can be used to solve the critical section problem.
Semaphore can be binary or counting while mutex is always...read more
Q64. What are threads? What is the purpose?
Threads are lightweight processes that enable multitasking within a single process.
Threads allow multiple tasks to be executed concurrently within a single process.
They share the same memory space and resources of the parent process.
Threads can improve performance by utilizing available CPU resources more efficiently.
Examples include web servers handling multiple requests simultaneously and video games rendering graphics while processing user input.
Q65. What are CORS? How to handle them?
CORS stands for Cross-Origin Resource Sharing. It is a security feature implemented in web browsers to restrict web pages from making requests to a different domain.
CORS is used to prevent malicious websites from accessing sensitive data from other websites.
To handle CORS, the server needs to include specific headers in the response to allow the browser to make requests from a different domain.
The most common header used to handle CORS is 'Access-Control-Allow-Origin'. It spe...read more
Q66. Sort an array of 0s,1s,2s in O(n) time.
Sort an array of 0s, 1s, 2s in linear time.
Use three pointers to keep track of the positions of 0s, 1s, and 2s.
Traverse the array once and swap elements based on their values.
The final array will have 0s, 1s, and 2s grouped together in that order.
Q67. Why you want to join Hashedin?
I am excited to join Hashedin because of its reputation for innovative solutions and collaborative work culture.
Hashedin has a strong track record of delivering cutting-edge technology solutions for clients across various industries.
I am impressed by the company's focus on collaboration and teamwork, which aligns with my own work style.
I am excited about the opportunity to work with a talented and diverse team of professionals at Hashedin.
Hashedin's commitment to employee gro...read more
Q68. Find if pair sum exists in array
Check if there exists a pair of numbers in the array that add up to a given sum.
Iterate through the array and for each element, check if the difference between the sum and the element exists in the array using a hash table.
Alternatively, sort the array and use two pointers to traverse from both ends towards the middle, adjusting the pointers based on the sum of the current pair.
Q69. What is sharding and how it can be implemented.
Sharding is a database partitioning technique to improve performance and scalability.
It involves dividing a large database into smaller, more manageable parts called shards.
Each shard contains a subset of the data and can be stored on a separate server.
Sharding can be implemented using different strategies such as range-based, hash-based, or round-robin.
It requires careful planning and coordination to ensure data consistency and availability.
Examples of sharding in popular da...read more
Q70. High Level Design for a Reddit type application
A Reddit-like application for sharing and discussing content
User authentication and authorization
Post creation and voting system
Commenting system
Subreddit creation and management
Search functionality
Real-time updates using websockets
Q73. Why should one use Node.JS?
Node.js is a powerful and efficient server-side JavaScript runtime environment.
Node.js is fast and scalable, making it ideal for building real-time applications.
It uses an event-driven, non-blocking I/O model, which makes it lightweight and efficient.
Node.js has a large and active community, with many useful libraries and modules available.
It allows for easy sharing of code between the server and client, using JavaScript on both sides.
Node.js is cross-platform, meaning it can...read more
Q74. Method overloading vs Method overriding
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a subclass method with the same name and parameters as a superclass method.
Method overloading is used to provide different ways of calling the same method with different parameters.
Method overriding is used to provide a specific implementation of a method in a subclass that is already defined in a superclass.
Method overloading is resolved at compile-time base...read more
Q75. Take several types of data in an array and print only numbers from there - Programming Hands-on (Java)
Q76. Why Hashedin
Hashedin is a leading software development company with a focus on delivering innovative solutions.
Expertise in cutting-edge technologies
Proven track record of successful project delivery
Strong emphasis on client satisfaction
Collaborative and agile approach to development
Dedicated team of experienced professionals
Q77. What are OS processes?
OS processes are instances of a program that are being executed by the operating system.
Processes are managed by the operating system's scheduler.
Each process has its own memory space and system resources.
Processes can communicate with each other through inter-process communication (IPC).
Examples of processes include web browsers, media players, and text editors.
Q78. Kth smallest element in array
Finding the Kth smallest element in an array.
Sort the array and return the Kth element.
Use a min heap to find the Kth smallest element.
Use quickselect algorithm to find the Kth smallest element.
Divide and conquer approach using binary search.
Use selection algorithm to find the Kth smallest element.
Q79. rotate a array k times
Rotate an array of strings k times
Create a temporary array to store elements that will be rotated
Use modulo operator to handle cases where k is greater than array length
Update the original array with elements from the temporary array
Q80. what is abstraction and encapsulation
Abstraction is the concept of hiding complex implementation details and showing only the necessary information. Encapsulation is bundling data and methods that operate on the data into a single unit.
Abstraction focuses on what an object does rather than how it does it
Encapsulation restricts access to some of an object's components, protecting the object's integrity
Abstraction allows for creating simple interfaces for complex systems
Encapsulation helps in achieving data hiding...read more
Q81. Why HashedIn ? How was your interview experience? Have will you handle difference of opinion With a team ? Share an experience where you resolved a critical issue ?
I chose HashedIn for its innovative projects and collaborative work culture.
Innovative projects attracted me to HashedIn
I value the collaborative work culture at HashedIn
I appreciate the opportunities for growth and learning at HashedIn
I was impressed by the team's technical expertise during the interview process
Q82. Performance Testing by Postman? Status codes, usage of PUT & POST
Q83. Explain the deadlock condition
Deadlock is a situation where two or more processes are unable to proceed because they are waiting for each other to release resources.
Occurs in multi-process systems
Processes hold resources and wait for others to release resources
Can lead to system freeze or crash
Prevented by proper resource allocation and scheduling
Example: Two trains on a single track, each waiting for the other to pass first
Q84. 2 sum using linked list
Use a hash table to find two numbers in a linked list that add up to a target sum.
Traverse the linked list and store each node's value in a hash table along with its index.
For each node, check if the difference between the target sum and the current node's value exists in the hash table.
If it does, return the indices of the two nodes.
Example: Given linked list 2 -> 4 -> 3 -> 5 and target sum 7, return indices 1 and 2.
Q85. Maximum subarray sum Length of Binary tree Merge Two sorted Linked List
The maximum subarray sum problem involves finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum.
Use Kadane's algorithm to find the maximum subarray sum efficiently.
Consider all possible subarrays and calculate their sums to find the maximum.
Dynamic programming can be used to solve this problem efficiently.
Example: For array [-2, 1, -3, 4, -1, 2, 1, -5, 4], the maximum subarray sum is 6 (from index 3 to 6).
Q86. Minimum Deletions to make a String Palindrome
Q87. Open W3School and find Xpath for search button manually - Hands-on
Q88. Low Level Design for Authentication
Low level design for authentication
Define authentication requirements
Choose appropriate authentication mechanism
Design authentication flow
Implement secure storage of credentials
Consider multi-factor authentication
Include error handling and logging
Q89. Design a database for instagram
Database design for Instagram platform
Create tables for users, posts, comments, likes, followers, and hashtags
Use primary and foreign keys to establish relationships between tables
Include fields such as user_id, post_id, comment_id, like_id, follower_id, and hashtag_id
Implement indexes for faster data retrieval
Consider scalability and performance optimization techniques
Q90. what is multiple inheritance
Multiple inheritance is a feature in object-oriented programming where a class can inherit attributes and methods from more than one parent class.
Allows a class to inherit attributes and methods from multiple parent classes
Can lead to the Diamond Problem where ambiguity arises if two parent classes have a method with the same name
Languages like C++ support multiple inheritance
Q91. Count occurence of element in an array
Count occurrence of element in an array of strings
Use a loop to iterate through the array
Use a dictionary to store the count of each element
Increment the count for each element encountered
Q92. System design of snake and ladder
System design for the game of Snake and Ladder
Create a board with 100 cells and mark the positions of snakes and ladders
Implement a player class with a current position on the board
Roll a dice to move the player and check for snakes and ladders
Keep track of player scores and winner at the end of the game
Q93. How you can handle the pressure
I handle pressure by prioritizing tasks, staying organized, seeking support when needed, and practicing stress-relief techniques.
Prioritize tasks based on deadlines and importance
Stay organized with to-do lists and calendars
Seek support from colleagues or supervisors when feeling overwhelmed
Practice stress-relief techniques such as deep breathing or exercise
Maintain a positive attitude and focus on problem-solving
Q94. Different types of Waits in Selenium? POM ?Relative/Absolute Xpath
Q95. What are assymptotic notation
Asymptotic notation is a way to describe the performance of an algorithm in terms of its input size.
Asymptotic notation is used to analyze the efficiency of algorithms by focusing on how they behave as the input size approaches infinity.
Common notations include O (Big O), Ω (Big Omega), and Θ (Big Theta), which represent the worst-case, best-case, and average-case time complexity respectively.
For example, if an algorithm has a time complexity of O(n^2), it means that the algo...read more
Q96. How do you handle Spark Memory management
Spark Memory management involves configuring memory allocation, monitoring memory usage, and optimizing performance.
Set memory allocation parameters in Spark configuration (e.g. spark.executor.memory, spark.driver.memory)
Monitor memory usage using Spark UI or monitoring tools like Ganglia
Optimize performance by tuning memory allocation based on workload and cluster resources
Use techniques like caching and persistence to reduce memory usage and improve performance
Q97. Code transpose of matrix
Transpose a matrix by swapping rows with columns
Iterate through each row and column and swap the elements
Create a new matrix with swapped rows and columns
Ensure the new matrix has the correct dimensions
Q98. Implement swap method.
Implement a swap method for two variables.
Create a temporary variable to store the value of one variable.
Assign the value of the second variable to the first variable.
Assign the value of the temporary variable to the second variable.
Q99. Depth of a binary tree
The depth of a binary tree is the number of edges on the longest path from the root node to a leaf node.
Depth of a binary tree can be calculated recursively by finding the maximum depth of the left and right subtrees and adding 1.
The depth of a binary tree with only one node (the root) is 0.
Example: For a binary tree with root node A, left child B, and right child C, the depth would be 1.
Q100. Middle of linked list.
To find the middle element of a linked list, use two pointers - one moving at double the speed of the other.
Use two pointers - slow and fast, with fast moving at double the speed of slow.
When fast reaches the end of the list, slow will be at the middle element.
Top HR Questions asked in Gabriel India
Interview Process at Gabriel India
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month