New
Know More
New
Know More
New
Know More
View All Preparation Packages

InfyTQ

No of Coding Questions
Coding Questions :
23
No. of MCQ Questions
MCQ Questions :
530
No. of Mock Tests
Mock Test :
20
Arrow leading towards next section of Landing Page

About InfyTQ 

Infosys is a global consulting and IT services company listed on the NYSE with over 239,000 employees. Based in Bangalore, India, the company is known for its business consulting, information technology, and outsourcing services. With a focus on digital transformation, Infosys helps clients in 46 countries navigate the digital landscape.

Infosys is committed to empowering businesses with agile digital solutions that drive performance and customer satisfaction. Through its continuous learning program, the company continually improves by sharing digital skills, expertise, and innovative ideas from its innovation ecosystem.

If you're looking to start a great career, InfyTQ is the best place to start with it. The InfyTQ exam is designed to help students learn about IT skills and expertise. It offers comprehensive study material, practice questions, and expert advice to help you prepare for the exam.

Infosys InfyTQ Best Practices:

To get the most out of InfyTQ, it's important to follow some best practices. Firstly, make sure you go through the syllabus thoroughly to get a clear understanding of the exam pattern. Secondly, utilize the study material to get a good grasp of the topics. Finally, practice with the InfyTQ practice questions to get a feel for the exam format.

Infosys InfyTQ Expert Advice:

To succeed in the InfyTQ exam, it's crucial to get advice from those who have already gone through the process. Fortunately, Edyst provides expert advice to help you prepare for the exam. You can also join online forums to connect with others who have taken the exam and get valuable tips and insights.

Infosys InfyTQ Practice Questions:

Practice questions are a key component of any exam preparation process. InfyTQ offers a wide range of practice questions that cover all topics in the syllabus. By practicing with these questions, you can improve your understanding of the concepts and get comfortable with the exam format.

Infosys InfyTQ Exam Pattern:

The InfyTQ exam pattern consists of a multiple-choice question (MCQ) test followed by a coding test. The MCQ test evaluates your knowledge of programming concepts, database management, and other IT-related topics. The coding test assesses your coding skills and ability to solve problems using programming languages like Java, Python, or C++.

Infosys InfyTQ Syllabus:

The InfyTQ syllabus covers a range of IT-related topics, including programming concepts, database management, data structures, algorithms, and software development. It's important to go through the syllabus carefully and focus on areas where you may need more practice.

Infosys InfyTQ Interview Questions:

If you successfully complete the InfyTQ exam, you may be eligible for an interview with Infosys. To prepare for the interview, it's important to review common interview questions related to the role you're applying for. Infosys also provides resources to help you prepare for the interview and showcase your skills and expertise.

Benefits of InfyTQ Certification 

1. Obtaining the globally recognized InfyTQ Certification will boost your resume and your will stand out in the job market. 

2. With InfyTQ Certification you get a chance to become a certified developer. 

3. This prestigious certification is open to a wide range of students from various educational backgrounds, including B.Tech, B.E, M.W, M.Tech, M.Sc, and M.C.A. 

4. Not only will the InfyTQ Certification give your resume a competitive edge, but it also gives you the chance to participate in off campus interviews at Infosys and potentially secure a position at the company. 

5. You can even attempt the InfyTQ Certification up to three times.

Eligibility Criteria for InfyTQ

1. If you are a student graduating in particular next year with a B.Tech, M.Tech, B.E, M.E, M.Sc, M.C.A., or MCM degree? Then you are eligible for the InfyTQ Certification Program of that year. For example, if you are graduating in 2023 then you are eligible for the InfyTQ Certification Program 2022-2023.

2. The InfyTQ Certification Program is a great opportunity for aspiring software programmers to showcase their skills. If you score at least 65% on the program, you may be contacted for an on-the-spot employment interview at Infosys.

3. It's worth noting that Infosys will not consider your college grades when calculating your InfyTQ Certification Program Score. This is your chance to demonstrate your abilities and potentially secure a position as a software programmer at Infosys.

Don't miss out on this opportunity to launch your career with InfyTQ. Make sure to apply for the InfyTQ Certification Program if you meet the eligibility requirements.

Exam Pattern for InfyTQ Certification

The InfyTQ Certification exam is designed to test your knowledge and skills in a variety of areas, including Python and Java programming, database management systems, and general aptitude. The exam consists of two rounds: the Qualifier Round and the Final Round.

The Qualifier Round is divided into three parts: 

  • Python and Java: 20 questions (you can choose between Java and Python when booking your slot)
  • DBMS: 10 questions
  • 10 aptitude questions

The Final Round is divided into two parts:

  • 20 objective type questions covering topics such as DBMS and SQL, data structures and algorithms, Java/Python programming, and OOPs
  • 2 Java/Python coding questions

Make sure to thoroughly prepare for both rounds of the InfyTQ Certification exam in order to increase your chances of success. This prestigious certification is a great way to enhance your resume and stand out in the job market.

Syllabus for InfyTQ Certification 

InfyTQ Certification covers a wide range of topics related to software development, including algorithms and data structures, requirement engineering, databases, Python programming, and agile development practices such as Scrum. The syllabus also mentions quality assurance and the waterfall development process, which is a traditional, linear approach to software development. 

Here is the complete list:

  • Algorithms and Data Structures – ALL
  • Requirement Engineering
  • Database – RDBMS Others
  • Python – Open System
  • Scrum
  • Quality Assurance
  • Development process on Object-Oriented 
  • Development based on Waterfall
Arrow leading towards next section of Landing Page

InfyTQ Selection Process

InfyTQ is a comprehensive certification program that consists of two main rounds: the Certification Round and the Advantage Round.

The Certification Round is divided into three sub-sections:

  • Section 1: Java/Python Hands-on Coding (2 questions)
  • Section 2: Java/Python MCQ (10 questions)
  • Section 3: Database Management System MCQ (10 questions)

You will have the choice to select your preferred programming language (Java or Python) at the time of booking your slot. This round will last for a total of 3 hours. If you pass the Certification Round with a score of 65% or higher, you will be eligible to move on to the Advantage Round.

The Advantage Round is a higher level coding round that consists of three sections:

  • Section 1: Java/Python Hands-on Coding (Question 1) - 50 marks
  • Section 1: Java/Python Hands-on Coding (Question 2) - 75 marks
  • Section 1: Java/Python Hands-on Coding (Question 3) - 100 marks

This round will also last for 3 hours and is worth a total of 225 marks. To pass the InfyTQ Certification Process, you will need to excel in both the Certification Round and the Advantage Round.

Post the advantage round you have,

InfyTQ Behavioral Interview-1

This is just an Infosys, technical interview to see whether it can offer you a position as a "System Engineer."

InfyTQ Interview-2

If you pass the InfyTQ Upgrade Test cut-off, you will be allowed to take the behavioral interview-2.

There is scope of getting a position at Infosys such as "Power Programming Role," "Systems Engineer Specialist," or "System Engineer," depending on how well you performed in the interview.

You might still be offered the position of system engineer. It entirely relies on how well you perform in the interview.

Arrow leading towards next section of Landing Page

Popular Questions

# Question 1

For the given list of numbers separated with a comma, where the numbers 5 and 8 are present and 8 always comes after 5, how do you calculate the sum of `num1` and `num2`, where `num1` is the sum of all numbers that do not lie between 5 and 8 in the input list and `num2` is the numbers formed by concatenating all numbers from 5 to 8 in the list?

# Example

```sh

Input: 3,2,6,5,1,4,8,9

Output: 5168

```

# Explanation

```

Num1: 3+2+6+9 = 20

Num2: 5148

Output: 5148+20 = 5168

```

# Question 1

Given a 2D array of integers, print the maximum sum of any hourglass shape in the array.

An hourglass shape is a subset of values with indices forming an hourglass shape:​

```sh

Input: a b c d e f g

```

# For example,

```sh

Input: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

```

The hourglass with the maximum sum is:

# Solution 1

We can solve this problem by iterating through each element in the 2D array and computing the sum of its hourglass shape. We can keep track of the maximum sum found so far and return it at the end.

To compute the sum of an hourglass shape, we can use the following formula:

# sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# where i and j are the indices of the top-left element of the hourglass shape.

Here is the complete solution:

```sh

from typing import List

def max_hourglass_sum(arr: List[List[int]]) -> int:

max_sum = -float('inf') # Initialize max sum to lowest possible value

# Iterate through each element in the 2D array

for i in range(len(arr) - 2):

for j in range(len(arr[i]) - 2):

# Compute the sum of the hourglass shape

sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# Update the max sum if necessary

max_sum = max(max_sum, sum)

return max_sum

```

# Question 2

What is the largest even number that can be produced from a string that contains a mixture of letters, numbers, and special characters, after removing duplicates, or -1 if no even number can be produced?

# For example,

```sh

Input: 3,2,6,5,1,4,8,9

Output: -1

```

```sh

Input: infosys@337

Output: Hello#81@21349

```

# Question 2

You are given a sequence of integers, and you are allowed to delete any number of elements from the sequence. The goal is to maximize the sum of the remaining elements. However, you must adhere to the following rule: for any two elements a and b in the final sequence, abs(a - b) -> 1.​

For example, given the sequence [1, 3, 2, 4], you can delete the 3 and 4 to obtain the maximum sum of 1 + 2 = 3.

Write a function

```sh

def max_sum(nums: List[int]) -> int

```

to solve the problem.

# Solution 2​

We can solve this problem using dynamic programming. We will use a 2D array dp where dp[i][j] represents the maximum sum of a subarray of nums ending at index i such that the difference between the minimum and maximum elements in the subarray is j.

# To compute dp[i][j], we can consider the following cases:

* If j > i, then the maximum sum is 0 because it is not possible to have a subarray of length j ending at index i.

* If j = 0, then the maximum sum is the sum of all elements in the subarray nums[0:i+1].

* If j > 0, then we can compute the maximum sum by considering all possible subarrays ending at index i such that the difference between the minimum and maximum elements is j. We can do this by iterating through all possible values of k from 0 to i and taking the maximum of dp[k][j-1] + sum(nums[k+1:i+1]).

We can initialize the array dp with all zeros and compute the values in a bottom-up manner. The final result is the maximum value in dp[n-1], where n is the length of nums.

# Here is the complete solution:

```sh

from typing import List

def max_sum(nums: List[int]) -> int:

n = len(nums)

# Initialize dp array with all zeros

dp = [[0] * n for _ in range(n)]

# Fill in the base cases

for i in range(n):

dp[i][0] = sum(nums[:i+1])

# Fill in the rest of the array in a bottom-up manner

for j in range(1, n):

for i in range(j, n):

for k in range(i):

dp[i][j] = max(dp[i][j], dp[k][j-1] + sum(nums[k+1:i+1]))

# Return the maximum value in dp[n-1]

return max(dp[n-1])

```

# Question 3

What is the least number of unique elements in the array after deleting N elements from the array, given an input number N and an array of elements?

# For example,

```sh

Input: N=2 and the array [1, 2, 3, 3, 4, 4]

Output: 2

```

# Question 3

Given an array of integers, find the length of the longest subarray such that the sum of the elements in the subarray is less than or equal to a given target value.

For example, given the array [1, 2, 3, 4, 5] and the target value 7, the longest subarray with a sum -> 7 is [1, 2, 3], which has a length of 3.

Write a function

```sh

def longest_subarray(arr: List[int], target: int) -> int

```

to solve the problem.

# Solution 3

We can solve this problem using the 2 pointers technique.

We will maintain two pointers start and end pointing to the beginning and end of the current subarray, respectively. We will initialize start to 0 and end to 1, and move end to the right until the sum of the elements in the subarray is greater than the target value.

Then, we will move start to the right until the sum of the elements in the subarray is -> the target value. We will keep track of the maximum length found so far and return it at the end.

# Here is the complete solution:

```sh

from typing import List

def longestsubarray(arr: List[int], target: int) -> int:

start = 0

end = 1

maxlen = 0

currsum = arr[start]

while end < len(arr):

# Move end to the right until the sum is greater than the target

while currsum + arr[end] <= target:

currsum += arr[end]

end += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

# Move start to the right until the sum is less than or equal to the target

while currsum > target:

currsum -= arr[start]

start += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

return maxlen

```

# Question 4

What is the longest prefix in a non-empty string containing only alphabets that is also a suffix, without overlap, and is case-sensitive, or -1 if no such prefix exists?

# For example,

```sh

Input: xxAbcxxAbcxx

Output: xx

```

```sh

Input: Racecar

Output: -1

```

# Question 5

How many distinct subarrays in an array of integers have an odd sum, where two subarrays are considered different if they either start or end at different indexes?

# For example,

```sh

Input: [1, 2, 3]

Output: 4

```

Previously Asked Question

# Question 1

For the given list of numbers separated with a comma, where the numbers 5 and 8 are present and 8 always comes after 5, how do you calculate the sum of `num1` and `num2`, where `num1` is the sum of all numbers that do not lie between 5 and 8 in the input list and `num2` is the numbers formed by concatenating all numbers from 5 to 8 in the list?

# Example

```sh

Input: 3,2,6,5,1,4,8,9

Output: 5168

```

# Explanation

```

Num1: 3+2+6+9 = 20

Num2: 5148

Output: 5148+20 = 5168

```

# Question 1

Given a 2D array of integers, print the maximum sum of any hourglass shape in the array.

An hourglass shape is a subset of values with indices forming an hourglass shape:​

```sh

Input: a b c d e f g

```

# For example,

```sh

Input: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

```

The hourglass with the maximum sum is:

# Solution 1

We can solve this problem by iterating through each element in the 2D array and computing the sum of its hourglass shape. We can keep track of the maximum sum found so far and return it at the end.

To compute the sum of an hourglass shape, we can use the following formula:

# sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# where i and j are the indices of the top-left element of the hourglass shape.

Here is the complete solution:

```sh

from typing import List

def max_hourglass_sum(arr: List[List[int]]) -> int:

max_sum = -float('inf') # Initialize max sum to lowest possible value

# Iterate through each element in the 2D array

for i in range(len(arr) - 2):

for j in range(len(arr[i]) - 2):

# Compute the sum of the hourglass shape

sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# Update the max sum if necessary

max_sum = max(max_sum, sum)

return max_sum

```

# Question 2

What is the largest even number that can be produced from a string that contains a mixture of letters, numbers, and special characters, after removing duplicates, or -1 if no even number can be produced?

# For example,

```sh

Input: 3,2,6,5,1,4,8,9

Output: -1

```

```sh

Input: infosys@337

Output: Hello#81@21349

```

# Question 2

You are given a sequence of integers, and you are allowed to delete any number of elements from the sequence. The goal is to maximize the sum of the remaining elements. However, you must adhere to the following rule: for any two elements a and b in the final sequence, abs(a - b) -> 1.​

For example, given the sequence [1, 3, 2, 4], you can delete the 3 and 4 to obtain the maximum sum of 1 + 2 = 3.

Write a function

```sh

def max_sum(nums: List[int]) -> int

```

to solve the problem.

# Solution 2​

We can solve this problem using dynamic programming. We will use a 2D array dp where dp[i][j] represents the maximum sum of a subarray of nums ending at index i such that the difference between the minimum and maximum elements in the subarray is j.

# To compute dp[i][j], we can consider the following cases:

* If j > i, then the maximum sum is 0 because it is not possible to have a subarray of length j ending at index i.

* If j = 0, then the maximum sum is the sum of all elements in the subarray nums[0:i+1].

* If j > 0, then we can compute the maximum sum by considering all possible subarrays ending at index i such that the difference between the minimum and maximum elements is j. We can do this by iterating through all possible values of k from 0 to i and taking the maximum of dp[k][j-1] + sum(nums[k+1:i+1]).

We can initialize the array dp with all zeros and compute the values in a bottom-up manner. The final result is the maximum value in dp[n-1], where n is the length of nums.

# Here is the complete solution:

```sh

from typing import List

def max_sum(nums: List[int]) -> int:

n = len(nums)

# Initialize dp array with all zeros

dp = [[0] * n for _ in range(n)]

# Fill in the base cases

for i in range(n):

dp[i][0] = sum(nums[:i+1])

# Fill in the rest of the array in a bottom-up manner

for j in range(1, n):

for i in range(j, n):

for k in range(i):

dp[i][j] = max(dp[i][j], dp[k][j-1] + sum(nums[k+1:i+1]))

# Return the maximum value in dp[n-1]

return max(dp[n-1])

```

# Question 3

What is the least number of unique elements in the array after deleting N elements from the array, given an input number N and an array of elements?

# For example,

```sh

Input: N=2 and the array [1, 2, 3, 3, 4, 4]

Output: 2

```

# Question 3

Given an array of integers, find the length of the longest subarray such that the sum of the elements in the subarray is less than or equal to a given target value.

For example, given the array [1, 2, 3, 4, 5] and the target value 7, the longest subarray with a sum -> 7 is [1, 2, 3], which has a length of 3.

Write a function

```sh

def longest_subarray(arr: List[int], target: int) -> int

```

to solve the problem.

# Solution 3

We can solve this problem using the 2 pointers technique.

We will maintain two pointers start and end pointing to the beginning and end of the current subarray, respectively. We will initialize start to 0 and end to 1, and move end to the right until the sum of the elements in the subarray is greater than the target value.

Then, we will move start to the right until the sum of the elements in the subarray is -> the target value. We will keep track of the maximum length found so far and return it at the end.

# Here is the complete solution:

```sh

from typing import List

def longestsubarray(arr: List[int], target: int) -> int:

start = 0

end = 1

maxlen = 0

currsum = arr[start]

while end < len(arr):

# Move end to the right until the sum is greater than the target

while currsum + arr[end] <= target:

currsum += arr[end]

end += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

# Move start to the right until the sum is less than or equal to the target

while currsum > target:

currsum -= arr[start]

start += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

return maxlen

```

# Question 4

What is the longest prefix in a non-empty string containing only alphabets that is also a suffix, without overlap, and is case-sensitive, or -1 if no such prefix exists?

# For example,

```sh

Input: xxAbcxxAbcxx

Output: xx

```

```sh

Input: Racecar

Output: -1

```

# Question 5

How many distinct subarrays in an array of integers have an odd sum, where two subarrays are considered different if they either start or end at different indexes?

# For example,

```sh

Input: [1, 2, 3]

Output: 4

```

Testimonials

Vaishnavi

Placed in
ServiceNow
-
24 LPA

Edyst's training style completely resonated with me. I approached programming as more than a subject. Thanks to Edyst team for the guidance!

Pruthviraj

Placed in
Futurense
-
9.5 LPA

Sakila

Placed in
Adobe
-
12 LPA

I started practising on Edyst platform since my 3rd year of college focused on placements & always liked the way they helped us when we were stuck at a particular problem.
Thank you, Edyst for all the assistance and amazing support!

Ria

Placed in
OLX
-
20 LPA

Sriram

Placed in
Seawise Capital
-
8 LPA

When I joined the Edyst courses I received personalized mentoring on how to crack coding rounds of different companies. Through a combination of coding skills and great projects, I received multiple offers above 6+ lakhs per annum. Finally I joined for 8+ Lakhs package. Thanks for all the support, from Edyst Team.

Dileep

Placed in
TCS Digital
-
7 LPA+

Being a mechanical student and getting into an IT company is very tough. One of the main reason I could able to crack TCS CodeVita is because of Edyst.
Aneeq sir, your doubt clearing sessions, daily assignments & incredible mentors support really brushed up my skills.

Arrow leading towards next section of Landing Page

Coding Interview Round Sample Questions 

Here are some examples of coding interview questions that may be asked (entry-level candidates with little or no professional experience):

# Question 1

For the given list of numbers separated with a comma, where the numbers 5 and 8 are present and 8 always comes after 5, how do you calculate the sum of `num1` and `num2`, where `num1` is the sum of all numbers that do not lie between 5 and 8 in the input list and `num2` is the numbers formed by concatenating all numbers from 5 to 8 in the list?

# Example

```sh

Input: 3,2,6,5,1,4,8,9

Output: 5168

```

# Explanation

```

Num1: 3+2+6+9 = 20

Num2: 5148

Output: 5148+20 = 5168

```

# Question 1

Given a 2D array of integers, print the maximum sum of any hourglass shape in the array.

An hourglass shape is a subset of values with indices forming an hourglass shape:​

```sh

Input: a b c d e f g

```

# For example,

```sh

Input: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

```

The hourglass with the maximum sum is:

# Solution 1

We can solve this problem by iterating through each element in the 2D array and computing the sum of its hourglass shape. We can keep track of the maximum sum found so far and return it at the end.

To compute the sum of an hourglass shape, we can use the following formula:

# sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# where i and j are the indices of the top-left element of the hourglass shape.

Here is the complete solution:

```sh

from typing import List

def max_hourglass_sum(arr: List[List[int]]) -> int:

max_sum = -float('inf') # Initialize max sum to lowest possible value

# Iterate through each element in the 2D array

for i in range(len(arr) - 2):

for j in range(len(arr[i]) - 2):

# Compute the sum of the hourglass shape

sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# Update the max sum if necessary

max_sum = max(max_sum, sum)

return max_sum

```

# Question 2

What is the largest even number that can be produced from a string that contains a mixture of letters, numbers, and special characters, after removing duplicates, or -1 if no even number can be produced?

# For example,

```sh

Input: 3,2,6,5,1,4,8,9

Output: -1

```

```sh

Input: infosys@337

Output: Hello#81@21349

```

# Question 2

You are given a sequence of integers, and you are allowed to delete any number of elements from the sequence. The goal is to maximize the sum of the remaining elements. However, you must adhere to the following rule: for any two elements a and b in the final sequence, abs(a - b) -> 1.​

For example, given the sequence [1, 3, 2, 4], you can delete the 3 and 4 to obtain the maximum sum of 1 + 2 = 3.

Write a function

```sh

def max_sum(nums: List[int]) -> int

```

to solve the problem.

# Solution 2​

We can solve this problem using dynamic programming. We will use a 2D array dp where dp[i][j] represents the maximum sum of a subarray of nums ending at index i such that the difference between the minimum and maximum elements in the subarray is j.

# To compute dp[i][j], we can consider the following cases:

* If j > i, then the maximum sum is 0 because it is not possible to have a subarray of length j ending at index i.

* If j = 0, then the maximum sum is the sum of all elements in the subarray nums[0:i+1].

* If j > 0, then we can compute the maximum sum by considering all possible subarrays ending at index i such that the difference between the minimum and maximum elements is j. We can do this by iterating through all possible values of k from 0 to i and taking the maximum of dp[k][j-1] + sum(nums[k+1:i+1]).

We can initialize the array dp with all zeros and compute the values in a bottom-up manner. The final result is the maximum value in dp[n-1], where n is the length of nums.

# Here is the complete solution:

```sh

from typing import List

def max_sum(nums: List[int]) -> int:

n = len(nums)

# Initialize dp array with all zeros

dp = [[0] * n for _ in range(n)]

# Fill in the base cases

for i in range(n):

dp[i][0] = sum(nums[:i+1])

# Fill in the rest of the array in a bottom-up manner

for j in range(1, n):

for i in range(j, n):

for k in range(i):

dp[i][j] = max(dp[i][j], dp[k][j-1] + sum(nums[k+1:i+1]))

# Return the maximum value in dp[n-1]

return max(dp[n-1])

```

# Question 3

What is the least number of unique elements in the array after deleting N elements from the array, given an input number N and an array of elements?

# For example,

```sh

Input: N=2 and the array [1, 2, 3, 3, 4, 4]

Output: 2

```

# Question 3

Given an array of integers, find the length of the longest subarray such that the sum of the elements in the subarray is less than or equal to a given target value.

For example, given the array [1, 2, 3, 4, 5] and the target value 7, the longest subarray with a sum -> 7 is [1, 2, 3], which has a length of 3.

Write a function

```sh

def longest_subarray(arr: List[int], target: int) -> int

```

to solve the problem.

# Solution 3

We can solve this problem using the 2 pointers technique.

We will maintain two pointers start and end pointing to the beginning and end of the current subarray, respectively. We will initialize start to 0 and end to 1, and move end to the right until the sum of the elements in the subarray is greater than the target value.

Then, we will move start to the right until the sum of the elements in the subarray is -> the target value. We will keep track of the maximum length found so far and return it at the end.

# Here is the complete solution:

```sh

from typing import List

def longestsubarray(arr: List[int], target: int) -> int:

start = 0

end = 1

maxlen = 0

currsum = arr[start]

while end < len(arr):

# Move end to the right until the sum is greater than the target

while currsum + arr[end] <= target:

currsum += arr[end]

end += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

# Move start to the right until the sum is less than or equal to the target

while currsum > target:

currsum -= arr[start]

start += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

return maxlen

```

# Question 4

What is the longest prefix in a non-empty string containing only alphabets that is also a suffix, without overlap, and is case-sensitive, or -1 if no such prefix exists?

# For example,

```sh

Input: xxAbcxxAbcxx

Output: xx

```

```sh

Input: Racecar

Output: -1

```

# Question 5

How many distinct subarrays in an array of integers have an odd sum, where two subarrays are considered different if they either start or end at different indexes?

# For example,

```sh

Input: [1, 2, 3]

Output: 4

```

Dropdown Icon
Dropdown Icon

# Question 1

Given a 2D array of integers, print the maximum sum of any hourglass shape in the array.

An hourglass shape is a subset of values with indices forming an hourglass shape:​

```sh

Input: a b c d e f g

```

# For example,

```sh

Input: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

```

The hourglass with the maximum sum is:

# Solution 1

We can solve this problem by iterating through each element in the 2D array and computing the sum of its hourglass shape. We can keep track of the maximum sum found so far and return it at the end.

To compute the sum of an hourglass shape, we can use the following formula:

# sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# where i and j are the indices of the top-left element of the hourglass shape.

Here is the complete solution:

```sh

from typing import List

def max_hourglass_sum(arr: List[List[int]]) -> int:

max_sum = -float('inf') # Initialize max sum to lowest possible value

# Iterate through each element in the 2D array

for i in range(len(arr) - 2):

for j in range(len(arr[i]) - 2):

# Compute the sum of the hourglass shape

sum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]

# Update the max sum if necessary

max_sum = max(max_sum, sum)

return max_sum

```

Dropdown Icon

# Question 2

You are given a sequence of integers, and you are allowed to delete any number of elements from the sequence. The goal is to maximize the sum of the remaining elements. However, you must adhere to the following rule: for any two elements a and b in the final sequence, abs(a - b) -> 1.​

For example, given the sequence [1, 3, 2, 4], you can delete the 3 and 4 to obtain the maximum sum of 1 + 2 = 3.

Write a function

```sh

def max_sum(nums: List[int]) -> int

```

to solve the problem.

# Solution 2​

We can solve this problem using dynamic programming. We will use a 2D array dp where dp[i][j] represents the maximum sum of a subarray of nums ending at index i such that the difference between the minimum and maximum elements in the subarray is j.

# To compute dp[i][j], we can consider the following cases:

* If j > i, then the maximum sum is 0 because it is not possible to have a subarray of length j ending at index i.

* If j = 0, then the maximum sum is the sum of all elements in the subarray nums[0:i+1].

* If j > 0, then we can compute the maximum sum by considering all possible subarrays ending at index i such that the difference between the minimum and maximum elements is j. We can do this by iterating through all possible values of k from 0 to i and taking the maximum of dp[k][j-1] + sum(nums[k+1:i+1]).

We can initialize the array dp with all zeros and compute the values in a bottom-up manner. The final result is the maximum value in dp[n-1], where n is the length of nums.

# Here is the complete solution:

```sh

from typing import List

def max_sum(nums: List[int]) -> int:

n = len(nums)

# Initialize dp array with all zeros

dp = [[0] * n for _ in range(n)]

# Fill in the base cases

for i in range(n):

dp[i][0] = sum(nums[:i+1])

# Fill in the rest of the array in a bottom-up manner

for j in range(1, n):

for i in range(j, n):

for k in range(i):

dp[i][j] = max(dp[i][j], dp[k][j-1] + sum(nums[k+1:i+1]))

# Return the maximum value in dp[n-1]

return max(dp[n-1])

```

Dropdown Icon

# Question 3

Given an array of integers, find the length of the longest subarray such that the sum of the elements in the subarray is less than or equal to a given target value.

For example, given the array [1, 2, 3, 4, 5] and the target value 7, the longest subarray with a sum -> 7 is [1, 2, 3], which has a length of 3.

Write a function

```sh

def longest_subarray(arr: List[int], target: int) -> int

```

to solve the problem.

# Solution 3

We can solve this problem using the 2 pointers technique.

We will maintain two pointers start and end pointing to the beginning and end of the current subarray, respectively. We will initialize start to 0 and end to 1, and move end to the right until the sum of the elements in the subarray is greater than the target value.

Then, we will move start to the right until the sum of the elements in the subarray is -> the target value. We will keep track of the maximum length found so far and return it at the end.

# Here is the complete solution:

```sh

from typing import List

def longestsubarray(arr: List[int], target: int) -> int:

start = 0

end = 1

maxlen = 0

currsum = arr[start]

while end < len(arr):

# Move end to the right until the sum is greater than the target

while currsum + arr[end] <= target:

currsum += arr[end]

end += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

# Move start to the right until the sum is less than or equal to the target

while currsum > target:

currsum -= arr[start]

start += 1

# Update the maximum length found so far

maxlen = max(maxlen, end - start)

return maxlen

```

Dropdown Icon
Dropdown Icon
Dropdown Icon

# Question 1

For the given list of numbers separated with a comma, where the numbers 5 and 8 are present and 8 always comes after 5, how do you calculate the sum of `num1` and `num2`, where `num1` is the sum of all numbers that do not lie between 5 and 8 in the input list and `num2` is the numbers formed by concatenating all numbers from 5 to 8 in the list?

# Example

```sh

Input: 3,2,6,5,1,4,8,9

Output: 5168

```

# Explanation

```

Num1: 3+2+6+9 = 20

Num2: 5148

Output: 5148+20 = 5168

```

Dropdown Icon

# Question 2

What is the largest even number that can be produced from a string that contains a mixture of letters, numbers, and special characters, after removing duplicates, or -1 if no even number can be produced?

# For example,

```sh

Input: 3,2,6,5,1,4,8,9

Output: -1

```

```sh

Input: infosys@337

Output: Hello#81@21349

```

Dropdown Icon

# Question 3

What is the least number of unique elements in the array after deleting N elements from the array, given an input number N and an array of elements?

# For example,

```sh

Input: N=2 and the array [1, 2, 3, 3, 4, 4]

Output: 2

```

Dropdown Icon

# Question 4

What is the longest prefix in a non-empty string containing only alphabets that is also a suffix, without overlap, and is case-sensitive, or -1 if no such prefix exists?

# For example,

```sh

Input: xxAbcxxAbcxx

Output: xx

```

```sh

Input: Racecar

Output: -1

```

Dropdown Icon

# Question 5

How many distinct subarrays in an array of integers have an odd sum, where two subarrays are considered different if they either start or end at different indexes?

# For example,

```sh

Input: [1, 2, 3]

Output: 4

```

Dropdown Icon
Dropdown Icon
Dropdown Icon
Dropdown Icon
Dropdown Icon
Dropdown Icon
Dropdown Icon
Dropdown Icon

Technical Interview Round Sample Questions 

Here are some examples of technical interview questions that may be asked (entry-level candidates with little or no professional experience):
Can you describe the difference between a static and a dynamic data structure?
Dropdown Icon
Can you give me an example of a time when you had to work with a team to solve a problem? How did you contribute to the solution?
Dropdown Icon
Coding Question
Dropdown Icon
Coding Question
Dropdown Icon
Coding Question
Dropdown Icon
How do you handle challenges or problems at work?
Dropdown Icon
How would you explain the difference between a stack and a queue?
Dropdown Icon
Popular Question 1
Dropdown Icon
Popular Question 2
Dropdown Icon
Popular Question 3
Dropdown Icon
Popular Question 4
Dropdown Icon
Popular Question 5
Dropdown Icon
Tell me about yourself and why you are interested in this role.
Dropdown Icon
What are your strengths and weaknesses?
Dropdown Icon
What is a linked list, and how does it differ from an array?
Dropdown Icon
What is an algorithm, and how do you analyze its time and space complexity?
Dropdown Icon
What is your favorite programming language and why?
Dropdown Icon
What is your favorite programming language and why?
Dropdown Icon
Why do you want to work for Infosys?
Dropdown Icon

HR Interview Round Sample Questions

Here are some examples of technical interview questions that may be asked (entry-level candidates with little or no professional experience):
Can you describe the difference between a static and a dynamic data structure?
Dropdown Icon
Can you give me an example of a time when you had to work with a team to solve a problem? How did you contribute to the solution?
Dropdown Icon
Coding Question
Dropdown Icon
Coding Question
Dropdown Icon
Coding Question
Dropdown Icon
How do you handle challenges or problems at work?
Dropdown Icon
How would you explain the difference between a stack and a queue?
Dropdown Icon
Popular Question 1
Dropdown Icon
Popular Question 2
Dropdown Icon
Popular Question 3
Dropdown Icon
Popular Question 4
Dropdown Icon
Popular Question 5
Dropdown Icon
Tell me about yourself and why you are interested in this role.
Dropdown Icon
What are your strengths and weaknesses?
Dropdown Icon
What is a linked list, and how does it differ from an array?
Dropdown Icon
What is an algorithm, and how do you analyze its time and space complexity?
Dropdown Icon
What is your favorite programming language and why?
Dropdown Icon
What is your favorite programming language and why?
Dropdown Icon
Why do you want to work for Infosys?
Dropdown Icon