Question: American Express | Online-Round | 01-Sep-2020
2
Entering edit mode

American Express visited for both 6-month internship and full time roles.

Internship stipend 70k monthly
CTC 13.27 LPA

Online Round

First Coding Question

You are given a string with lowercase alphabetical characters. You need to remove the minimum number of characters such that each letter has a unique number of occurrences in the remaining string.

Example Input
aaabbb
Example Output
aabbb

Second Coding Question

Lets define a switching slice as an array which has all the elements at even places equal to each other and same goes for the elements at the odd places.

You are given an arrayA you need to return the length of the longest subarray of A which is is switching slice.

Example input
[7,4,2,4,2,9]
Example Output
4

Third Coding Question

You visit a casino and you play multiple games in one night.
In each game you bet in 2 ways :
1. Bet one chip
2. Bet all-in
Each time you win you get twice the number of chips you bet and each time you loose you don't get anything back (Gambling xD) .
Last night was your luckiest and you won all the games in the casino. You started with one single chip and left the casino with N chips.
Also you played all-in bets not more than K times. Your task is to calculate the minimum number of rounds that you could have played to satisfy all the requirements.


Example input
N = 8 , K = 0
Example Output
7
ADD COMMENTlink 4.3 years ago Shubhendu Goel • 450

Login before adding your answer.

Similar Posts
Loading Similar Posts