Today i gave my OA for amazon 6M internship india. The OA had 41 questions across 9 sections like hands on programming, data structures, linux, algorithms, pseudocode, networks, software planning, database, one more section i dont remember.
In hands on programming there was only one question to be solved.
so in total 1 coding question and rest 40 mcq questions. total test duration was 90 minutes.
here is the question, please share your solution. Also let me know what is the difficulty of this problem -
Tyler durden is a salesperson and is assigned a task to travel to sell soaps. He must travel to different countries with S states each. His manager has also provided him with an integer array of A, of length N. Array A represents a rating list which shows the past sales in a certain state. Below are a few ules for him to follow to increase the efficiency of his travel :-
Your task is to help tyler plan his travel route and return an integer value representing the country and the rating of the state tyler will be travelling to in month M based on the rating list.
NOTE -
Input -
Input1 : An integer value N, representing the length of rating list
Input2 : An integer value S, representing the number of states in a country
Input3 : An integer value M, representing the month numbers
Input4 : An integer array A, representing the rating list
Output -
Output1 : Return the country tyler will be travelling to in month M based on the rating list
Output2 : Return the state tyler will be travelling to in month M based on the rating list
Example 1 -
Input1 : 6
Input2 : 3
Input3 : 6
Input4 : {2, 1, 9, 3, 1, 4}
Output1 : 2
Output2 : 4
Explanation - there are 6 states, and each country has 3 states.
route will be country 1 --> country 2 (since the lowest rating is same in both the countries, we look at the second lowest rating and thus tyler will start his travel with country 1)
Example 2 -
Input1 : 12
Input2 : 3
Input3 : 7
Input4 : {4, 5, 7, 9, 3, 2, 5, 1, 3, 2, 4, 1}
Output1 : 2
Output2 : 2
Explanation - there are 12 states, and each country has 3 states.
route will be country 4 --> country 3 --> country 2 ---> country 4 (since the lowest rating is same in countries 4 and 3, we look at the second lowest rating and thus tyler will start his travel with country 4)
prewritten code :
//two libraries were included here which i don't remember
Struct Result {
int output1;
int output2;
};
Result profitDevelopment(int input1, int input2, int input3, int input4[]) {
//write your code from here
}