ApplicateAI Coding Questions And Answers

ApplicateAI Coding Questions with Solutions

ApplicateAI Coding Questions and Answers page will help you to get sample Coding Questions asked in the Online Selection Process of ApplicateAI.
Go through this page to get all Sample ApplicateAI Coding Questions for preparing for Online Assessments and Technical Interviews of the same.

ApplicateAI coding question

Practice ApplicateAI Coding Questions and Answers

Question 1 

Problem Statement  :

You’re given a string, you’ve to print additional characters needed to make that string a palindrome.

A Palindrome is a sequence of characters that has the property of reading the same in either direction.

Input :
abede
Output :
ba

Sample Input :
abcfe

Sample output :
fcba

Question 2

A taxi can take multiple passengers to the railway station at the same time.On the way back to the starting point,the taxi driver may pick up additional passengers for his next trip to the airport.A map of passenger location has been created,represented as a square matrix.

The Matrix is filled with cells,and each cell will have an initial value as follows:

  • A value greater than or equal to zero represents a path.
  • A value equal to 1 represents a passenger.
  • A value equal to -1 represents an obstruction.

The rules of motion of taxi are as follows:

  • The Taxi driver starts at (0,0) and the railway station is at (n-1,n-1).Movement towards the railway station is right or down,through valid path cells.
  • After reaching (n-1,n-1) the taxi driver travels back to (0,0) by travelling left or up through valid path cells.
  • When passing through a path cell containing a passenger,the passenger is picked up.once the rider is picked up the cell becomes an empty path cell.
  • If there is no valid path between (0,0) and (n-1,n-1),then no passenger can be picked.
  • The goal is to collect as many passengers as possible so that the driver can maximize his earnings.

For example consider the following grid,

0      1
-1     0

Start at top left corner.Move right one collecting a passenger. Move down one to the destination.Cell (1,0) is blocked,So the return path is the reverse of the path to the airport.All Paths have been explored and one passenger is collected.

Returns:

  • Int:maximum number of passengers that can be collected.

Sample Input 0

  • 4  -> size n = 4
  • 4 -> size m = 4
  • 0 0 0 1 -> mat
  • 1 0 0 0
  • 0 0 0 0
  • 0 0 0 0

Output 0

  • 2

Explanation 0

The driver can contain a maximum of 2 passengers by taking the following path
(0,0) → (0,1) → (0,2) → (0,3) → (1,3) → (2,3) → (3,3) → (3,2) → (3,1) → (3,0) → (2,0) → (1,0)  → (0,0)

Sample Input 1

STD IN                  Function

————              ————-

  •    3     →  size  n=3
  •    3    →  size m=3
  •    0 1 -1 → mat
  •    1 0 -1
  •    1 1 1

Sample Output 1

  • 5

Explanation 1

The driver can contain a maximum of 5 passengers by taking the following path
(0,0) → (0,1) → (1,1) → (2,1) → (2,2) → (2,1) → (2,0) → (1,0) → (0,0)

Prime Course Trailer

Related Banners

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

Question 3 

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 4 

Problem Statement -:

In an airport, the Airport authority decides to charge a minimum amount to the passengers who are carrying luggage with them. They set a threshold weight value, say, T, if the luggage exceeds the weight threshold you should pay double the base amount. If it is less than or equal to threshold then you have to pay $1.  

Function Description:

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

Parameters:

NameTypeDescription
NIntegernumber of luggage
TIntegerweight of each luggage
weights[ ]Integer arraythreshold weight

Returns: The function must return an INTEGER denoting the required amount to be paid.

Constraints:

  • 1 <= N <= 10^5
  • 1 <= weights[i] <= 10^5
  • 1 <= T <= 10^5

Input Format for Custom Testing:

  • The first line contains an integer, N, denoting the number of luggage. 
  • Each line i of the N subsequent lines (where 0 <= i <n) contains an integer describing the weight of ith luggage. 
  • The next line contains an integer, T, denoting the threshold weight of the boundary wall.

Sample Cases:

  • Sample Input 1
    4
    1
    2
    3
    4
    3
  • Sample Output 1
    5
  • Explanation:
    Here all weights are less than threshold weight except the luggage with weight 4 (at index 3) so all pays base fare and it pays double fare.

Question 5:

Given two strings, s, and sub, along with a 2D character array mappings, we want to determine if it is possible to make the sub a substring of s by replacing characters according to the provided mappings. Each mapping consists of a pair [oldi, newi], indicating that we can replace the character oldi in sub with newi.
The replacement can be performed any number of times, but each character in sub can be replaced at most once.
We need to return true if it is possible to create sub as a substring of s using the given replacements, and false otherwise.

Example 1:

Input:
s = “fool3e7bar”
sub = “leet”
mappings = [[“e”,”3″],[“t”,”7″],[“t”,”8″]]
Output: True

Explanation:
We replace the first occurrence of ‘e’ in sub with ‘3’ and ‘t’ in sub with ‘7’, resulting in sub becoming “l3e7”. Now, “l3e7” is a substring of s, so we return true.

Example 2:
Input:
s = “fooleetbar”

sub = “f00l”
mappings = [[“o”,”0″]]
Output: False

Explanation:
The string “f00l” is not a substring of s, and no replacements can be made to create it. Additionally, we cannot replace ‘0’ with ‘o’, so it is not possible to create sub from s. Hence, we return false.

Example 3:
Input:
s = “Fool33tbaR”
sub = “leetd”
mappings = [[“e”,”3″],[“t”,”7″],[“t”,”8″],[“d”,”b”],[“p”,”b”]]
Output: True

Explanation:
We replace the first and second occurrences of ‘e’ in sub with ‘3’ and ‘d’ in sub with ‘b’, respectively. This transforms sub into “l33tb”, which is a substring of s. Therefore, we return true.

Constraints:
1 <= sub.length <= s.length <= 5000

0 <= mappings.length <= 1000
mappings[i].length == 2
oldi != newi
Both s and sub consist of uppercase and lowercase English letters and digits.
oldi and newi are either uppercase or lowercase English letters or digits.

Question 6 :

Problem statement :

Stephan is a vampire. And he is fighting with his brother Damon. Vampires get energy from human bloods, so they need to feed on human blood, killing the human beings. Stephan is also less inhuman, so he will like to take less life in his hand. Now all the people’s blood has some power, which increases the powers of the Vampire. Stephan just needs to be more powerful than Damon, killing the least human possible. Tell the total power Stephan will have after drinking the bloods before the battle.
Note that: Damon is a beast, so no human being will be left after Damon drinks everyone’s blood. But Stephan always comes early in the town.

Input Format :
First line with the number of people in the town, n.
Second line with a string with n characters, denoting the one digit power in every blood.

Output Format :
Total minimum power Stephan will gather before the battle.

Constraints :
n<=10^4

Sample input :
6
093212

Sample output:
9

Explanation :
Stephan riches the town, drinks the blood with power 9. Now Damon cannot reach 9 by drinking all the other bloods.

Question 7:

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 8:

Problem Statement  :
Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned.
Note that:
Ratan never goes into loss.

Example 1 :
Price=[1,6,2]
Ratan buys it on the first day and sells it on the second.
Example 2 :
Price=[9,8,6]

The Price always went down, Ratan never bought it.

Input Format:
First line with an integer n, denoting the number days with the value of the stack
Next n days, telling the price of the stock on that very day.

Output Format:
Maximum profit done by Ratan in a single line.
Constraints:
Number of days <=10^8

Sample Input for Custom Testing:

STDIN
7
1
9
2
11
1
9
2

Sample Output :

10

Explanation :

The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.

Question 9:

Problem Statement  :

A company has a list of jobs to perform. Each job has a start time, end time and profit value. The manager has asked his employee Anirudh to pick jobs of his choice. Anirudh being greedy wants to select jobs for him in such a way that would maximize his earnings.
Given a list of jobs how many jobs and total earning are left for other employees once Anirudh
Picks jobs of his choice.
Note: Anirudh can perform only one job at a time.

Input format:

Each Job has 3 pieces of info – Start Time,End Time and Profit
The first line contains the number of Jobs for the day. Say ‘n’. So there will be ‘3n lines
following as each job has 3 lines.
Each of the next ‘3n’ lines contains jobs in the following format:
start_time
end-time
Profit
start-time and end-time are in HHMM 24HRS format
i.e. 9am is 0900 and 9PM is 2100

Constraints :

The number of jobs in the day i.e’ is less.
than 10000
0<_n<_10000
start-time is always less than end time.

Output format :

Program should return an array of 2 integers where
1st one is number of jobs left and earnings of other employees

Sample Input 1 :
4
0200
0300
10
0400
0700
20
0300
0800
30
0900
1000
50

Sample Output 1:
1
20

Sample Explanation 1

CHooses 1st, 3rd and 4th job cause they don’t overlap. So only second job is remaining.

Sample Input 2:

5
0805
0830
100
0835
0900
100
0905
0930
100
0935
1000
100
1005
1030
100

Sample output 2:

0
0

Sample Explanation 2:
Anirudh can work on all appointments as there are none overlapping.
Hence 0 appointments and 0 earnings for other employees.

Question 10 :

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.

FAQs related to ApplicateAI

Question 1: What are the roles offered in ApplicateAI?

The roles offered in this hiring of  ApplicateAI is for Software Engineer Trainee and Business Analyst Trainee, your role would initially involve extensive training for imparting the required level of skills, for effectively carrying out the official responsibilities assigned to you.

Question 2: What is ApplicateAI Recruitment Process?

The Online Selection Process consist of 

  • Written test
  • Technical interviews
  • HR discussion
Question 3:What is online assessment test in ApplicateAI?

The Online Assessment consist of

  • Aptitude
  • Java mcq
  • JavaScript mcq
  • Java coding
  • JavaScript coding
Question 4: What is the Eligibility Criteria for the ApplicateAI Recruitment Process?

 The Eligibility criteria is BTech in CSE&IT only 2024 batch, and having 65% and above in 10th and 12th, and CGPA 6.5 and above in B. Tech. With no active backlog(s). 

Question 5: What is the Salary offered for the roles?

The Salary Package during six months training period is one twelfth of the annual package of INR 6.00 Lakhs, and later Students will be converted as full time employees (based on the performance during the six months Training / Probation Period) at the Salary Package ranging from INR 6.00 Lakhs to INR 14.10 Lakhs 

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