American Express Coding Questions and Answers

American Express Coding Questions with Solutions

Here, on this page, you will get the sample American Express Coding Questions and Answers along with Recruitment Process, Eligibility Criteria, CTC Offered, and other insights on Job Profile offered by American Express.

Go through this page to get all the details related to American Express recruitment drive along with the coding questions asked in both online assessment and technical interview of the company.

american-express-coding-questions

Steps of American Express Recruitment Process

American Express generally conducts its recruitment drive in 3 Steps that have been mentioned below:

  1. Online Assessment [ Aptitude + Coding Based Questions ]
  2. Technical Interview 
  3. HR Interview
Here we have mentioned some significant details of American Express Coding Questions Recruitment Drive in the following tabular form:
American Express Related Information
Position :
  • Software Developer Engineer 
  • Software Engineer
Course :
  • B.E / B.Tech or M.E / M.Tech – Any Stream
  • Eligible Batch: 2023 and 2024
Eligibility Criteria / Academic Qualification Required :
  • Minimum 60 % is required in 10th or 12th.
  • Minimum 65 % is required in Graduation or Post Graduation.
  • No Current Backlogs
Cost to Company (CTC)
  1. For Software Developer Engineer = ₹ 10 – 15 L.P.A
  2. For Software Engineer = ₹ 8 – 12 L.P.A
Selection Process :
  1. Online Assessment (~ 2 – 3 Hours Duration)
  2. Technical Interview
  3. HR Interview

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

American Express Coding Questions with Solutions

Question 1 : Good Prime Number

Problem Statement  :

A prime number is a number which is divisible by one and itself. Also a number is called a good  prime number if the sum of its digits is a prime number. For example a number 23 is a good prime number because the sum of 2 and 3 ( 2+3=5) is 5 which is a prime number. You are given an integer K. Your task is to find the kth good prime number that is greater than a provided number N.

For example , 232 is a good prime number since the sum of all digits is 7 which is a prime number whereas 235 is not a good prime number.

Input format :

  • The first line contains an integer N.
  • The next line contains an integer K.

Output format :
A single integer which is a Kth good prime number that is greater than a provided number N.

Constraints :

  • 1<=N<=10^5
  • 1<=K<<=10^5

Sample Input 1:
4  4

Sample Output 1:
12

Explanation :
Good prime numbers starting from 4 are 5,7,11(1+1=2 which is prime number),12(1+2=3 which is prime number),14(1+4=5 which is a prime number) and so on. Because the sum of digits of an individual number is a prime number And 4 th good prime number is 12 in this series.Hence the output is 12. 

Sample Input 2:
17  5

Sample Output 2:
29

Explanation :

Good prime numbers starting from 17 are 20,21,23,25,29…and the 5th prime number is 29.Hence the output is 29.

Question 2: Death Note

Problem Statement  :

Ryuk, the Shinigami (God of death) had allowed Light Yagami, a school student, to kill as many people as he can by using a death note. But writing the names barely will allow other people to watch them. So he encrypts the names using digits, where a means 1, b means 2 and so on upto z is 26. Now if he gives numbers, there is a communication error because a number string can be decrypted by the death note in various ways and eventually killing them all. If everyone in the world has a unique name, for a given number, how many people can die?
NOTE THAT: There is every possible name in the world with the 26 letters, and capital or small letters is not a problem.

Input format:
A number stream denoting the first name’s encrypted version

Output Format:
Number of people dying by this.

Constraints:
1<=stream length<=10^8

Sample Input: 1267
Sample Output: 3
Output Specification:Two people of the name azg and lfg die.

Question 3 :Find no. of tyres

Problem Statement  :

In the city, there are a bunch of dealerships who sell bikes & cars. A function is there which tells how many dealerships there are and the total number of cars in each dealership.

Your job is to calculate how many tyres would be there in each dealership.
If you are using the predefined function use this structure,

Struct dealership {
Int cars;
Int bikes;
}

Input :                 Output :
3                          20
4 2                      16
4 0                       8
1 2

Explanation :

  1. There are total 3 dealerships
  2. Dealerships1 contains 4 cars and 2 bikes
  3. Dealerships2 contains 4 cars and 0 bikes
  4. Dealerships3 contains 1 cars and 2 bikes
  5. Total number of tyres in dealerships1 is (4 x 4) + (2 x 2) = 20
  6. Total number of tyres in dealerships2 is (4 x 4) + (0 x 2) = 16
  7. Total number of tyres in dealerships3 is (1 x 4) + (2 x 2) = 8

Question 4 : Simple problem

Problem Statement :

Mr X is a teacher of maths. He came across a very simple problem. In the problem you have to arrange the numbers in an ascending order and calculate the total number of swaps required. The number of swaps must be minimum. But Mr X is busy with some other tasks and you being his favourite student , so he asks you to solve this problem.

Constraints:

1<=T<=100
1<=N<=100
1<=A[ ] <=1000
Examples

Input :
4
4 3 1 2
Output:
2
Explanation: Swap index 0 with 3 and 1 with 2 to form the sorted array {1, 2, 3, 4}.

Input :
5
1 5 4 3 2
Output :
2

Question 5: Parallel Columbus

Problem Statement –  Nobel Prize-winning Austrian-Irish physicist Erwin Schrödinger developed a machine and brought as many Christopher Columbus from as many parallel universes as he could. Actually, he was quite amused by the fact that Columbus tried to find India and got America. He planned to dig it further.

Though totally for research purposes, he made a grid of size n X m, and planted some people of America in a position (x,y) [in 1 based indexing of the grid], and then planted you with some of your friends in the (n,m) position of the grid. Now he gathered all the Columbus in 1,1 positions and started a race.

Given the values for n, m, x, y, you have to tell how many different Columbus(s) together will explore you as India for the first time.

Remember, the Columbus who will reach to the people of America, will be thinking that as India and hence wont come further.

Function Description:

Complete the markgame function in the editor below. It has the following parameter(s):

Parameters:

NameTypeDescription
nInteger

The number of rows in the grid.

mIntegerThe number of columns in the grid.
xIntegerThe American cell’s Row.
yIntegerThe American cell’s Column.

Constraints:

  • 1 <= n <= 10^2
  • 1 <= m <= 10^2
  • 1 <= x <= n
  • 1 <= y <= m

Input Format:

  • The first line contains an integer, n, denoting the number of rows in the grid.
  • The next line contains an integer m, denoting the number of columns in the grid.
  • The next line contains an integer, x, denoting the American cell’s row.
  • The next line contains an integer, y, denoting the American cell’s column.

Sample Cases

Sample Input 1

2

2

2

1

Sample Output 1

1

Explanation

The only way possible is (1,1) ->(2,1) -> (2,2), so the answer is 1. 

Question 6 : Seating Arrangement in Exam Hall

Problem Statement  :

Semester exams are going on for university students. Examiners noticed that a group of people are trying to cheat. They marked students of that group as ‘1’ and students of another group ( who are not cheating ) as ‘0’ 

We can reduce cheating by not allowing students from group 1 to sit together, means no two students from group 1 can sit together. Seatings are marked using above conditions. Your task is to give the seating placement of nth possibility Possibility order from 1 to 10 is given below

[1  10  100  101  1000  1001  1010  10000  10001  10010]

Sample input :

3 → number of test cases

4

6

9

Sample output :

101

1001

10001

Explanation :

4th possibility is 101 

6th possibility is 1001

9th possibility is 10001

Question 7: Array Subarray

Problem Statement: You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.

Sample input :

  • 1 → Length of segment x =1
  • 5 → size of space n = 5
  • 1 → space = [ 1,2,3,1,2]
  • 2
  • 3
  • 1
  • 2

Sample output :

  • 3

Explanation :

  • The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3

Question 8 : Coin Game (R->Medium)

Problem Statement  :

Raman was playing a game, he starts with x coins. Now in every step, he wins and loses and he has to get the money or pay the money as needed. He came in contact with a psychic who can see the future and the Psychic predicted the outcomes after each step. Now Raman wants to start the game with the minimum wage where he doesn’t run out of money. Help Raman to find what money he should start with. The only rule to keep playing is not going in a credit situation.

Input Format:

First line with n, number of steps in the game
Next n lines, n integers denoting outcomes of every game. Positive means winning and negative means losing that money.

Output Format:

One single integer denoting the minimum amount to start with

Constraints:

Number of steps<=10^9
-1000<=Money needed in each step<=1000

Sample Input:

4
2
-9
15
2

Sample Output:

7

Explanation:

If he starts with 7 rupees, then after steps : 7 ->9 -> 0-> 15 -> 17.

Question 9 : Number with 2

Problem Statement  :

Suppose you are in a number system, where if the number doesn’t contain 2 in the unit digit then the number is not valid. So the first number of the number system is 2, the second number is 12, and the third is 22.
for a given integer n, you have to print the nth element of the number system.

Input Format:
First line, containing n denoting the number of test cases.
then n number of lines for the query.

Output Format:
Print the consecutive number in the number system for each query.

Sample Input:
3

Sample Output:
22

Explanation:
1st number will be 2 , 2nd number will be 12 and third number will be 32

Question 10 : Spiral Matrix

Problem Statement :

You will be given a 2d matrix. Write the code to traverse the matrix in a spiral format. Check the input and output for better understanding.

Sample Input :
Input :
5 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20

Output :

1 2 3  4 5 6 7 8 9 10 11 12 13 14  15 16 17 18 19 20

FAQs related to American Express Coding Questions

Question 1: What is the American Express hiring process?

American Express recruitment drive includes 3 steps:

  • Round 1: Online Assessment
  • Round 2: Technical Interview
  • Round 3: HR Interview
Question 2: How many sections are present in American Express Online assessment?
  1. Section 1: Aptitude Based Questions
  2. Section 2: Coding Questions [ OOPs, Data Structures and Algorithms based Questions ]
Question 3: How much time American Express takes to complete one Recruitment drive ?

Usually American Express takes 3 – 4 weeks to complete whole Recruitment Drive.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription