Info Edge
10+ AccorHotels Interview Questions and Answers
Q1. Buy and Sell Stock Problem Statement
Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more
The task is to determine the maximum profit that can be achieved by performing up to two buy-and-sell transactions on a given set of stock prices.
Iterate through the array of stock prices to find the maximum profit that can be achieved by buying and selling stocks at different points.
Keep track of the maximum profit that can be achieved by considering all possible combinations of buy and sell transactions.
Ensure that you sell the stock before you can buy again to adhere to th...read more
Q2. Boundary Traversal of a Binary Tree
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
Input:
The first line contains...read more
Return the boundary nodes of a binary tree in Anti-Clockwise direction starting from the root node.
Traverse the left boundary nodes in top-down order
Traverse the leaf nodes in left-right order
Traverse the right boundary nodes in bottom-up order
Handle cases where duplicates occur in boundary nodes
Q3. Number of Bit Flips Problem Statement
Ninja is practicing binary representations and stumbled upon an interesting problem. Given two numbers 'A' and 'B', you are required to determine how many bits need to be f...read more
Calculate the number of bit flips required to convert one number to another in binary representation.
Convert both numbers to binary representation
Count the number of differing bits between the two numbers
Output the count of differing bits as the number of bit flips required
Example: A = 13 (1101), B = 7 (0111) -> 2 bit flips required
Q4. Reverse Linked List in Groups of K
You are provided with a linked list containing 'N' nodes and an integer 'K'. The task is to reverse the linked list in groups of size K, which means reversing the nodes in eac...read more
Reverse a linked list in groups of size K by reversing nodes in each group.
Iterate through the linked list in groups of size K
Reverse each group of nodes
Handle cases where the number of elements in the last group is less than K
Q5. 2. From an array of integers which contains values for a particular stock . Find the value at which a person should buy and sell such that the profit is maximum.
Find the maximum profit from buying and selling a stock given an array of its values.
Iterate through the array and keep track of the minimum value seen so far.
Calculate the profit at each index and update the maximum profit seen.
Return the maximum profit.
Q6. 1. Count the number of flips require to convert a binary string of 0 and 1 such that resultant string has alternate 0 and 1
Count the number of flips required to convert a binary string to alternate 0 and 1.
Iterate through the string and count the number of flips required to make it alternate.
Keep track of the current character and the expected character.
Example: 001101 -> 010101 requires 2 flips.
Example: 101010 -> 010101 requires 3 flips.
Q7. 4. Reverse a linked list in groups of k nodes.
Reverse a linked list in groups of k nodes.
Divide the linked list into groups of k nodes
Reverse each group of k nodes
Connect the reversed groups to form the final linked list
Use recursion or iteration to implement the solution
Q8. 3. Boundary traversal of a tree.
Boundary traversal of a tree
Boundary traversal involves visiting the nodes on the boundary of a tree in a specific order
Start with the root node and traverse the left boundary, then the leaf nodes from left to right, and finally the right boundary
Use recursion to traverse the left and right subtrees
Exclude the leaf nodes that are also part of the left or right boundary
Q9. coding assignment for binary search
Implement binary search algorithm to find a target string in a sorted array of strings.
Ensure the array of strings is sorted before performing binary search.
Compare the target string with the middle element of the array and adjust the search range accordingly.
Repeat the process until the target string is found or the search range is exhausted.
Q10. Build an MVC architecture
MVC architecture separates an application into Model, View, and Controller components for better organization and scalability.
Model represents the data and business logic
View displays the data to the user
Controller handles user input and updates the model
Example: Model - User class with properties like name, email; View - HTML template to display user info; Controller - User controller to handle user actions
Interview Process at AccorHotels
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month