
Engati

Engati Interview Questions and Answers
Q1. Largest element in an array without using any stl functions
Find the largest element in an array without using any STL functions.
Iterate through the array and compare each element with the current largest element.
Update the largest element if a larger element is found.
Return the largest element at the end.
Q2. Implementing queue from2 stacks
Implement a queue using two stacks
Use two stacks - one for enqueue operation and one for dequeue operation
When dequeue is called, check if the second stack is empty. If it is, pop all elements from the first stack and push them onto the second stack
Time complexity for enqueue operation is O(1) and for dequeue operation is O(n)
Q3. 3 ants on a triangle puzzle
Three ants are placed at the corners of an equilateral triangle. Each ant randomly picks a direction and starts moving. What is the probability that they do not collide?
Calculate the probability of each ant moving in a different direction (1/3 * 1/3 * 1/3 = 1/27)
Calculate the probability of each ant moving in the same direction (1/3)
Subtract the probability of colliding (1/27) from 1 to get the probability of not colliding (26/27)
Q4. Reverse a string
Reverse a given string
Use a loop to iterate through the characters of the string and build a new string in reverse order
Alternatively, you can use built-in functions like reverse() or StringBuilder in some programming languages
Make sure to handle edge cases like empty string or null input
Q5. What is AI, what do you know about chatbots
AI stands for Artificial Intelligence, chatbots are AI-powered programs that simulate conversation with users.
AI is the simulation of human intelligence processes by machines, typically computer systems.
Chatbots are AI-powered programs that can simulate conversation with users through text or voice.
Chatbots are commonly used in customer service, marketing, and other business applications.
Examples of chatbots include Siri, Alexa, and customer service chatbots on websites.
Q6. Mover zeros to the lend of the array without changing the order
Move zeros to the end of the array without changing the order.
Iterate through the array and count the number of zeros
Create a new array with all the non-zero elements
Append the counted number of zeros at the end of the new array
Q7. Find second smallest element in the array
The second smallest element in an array is found by sorting the array and selecting the element at index 1.
Sort the array in ascending order
Access the element at index 1 to get the second smallest element
Interview Process at Engati

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

