Create viral videos with

GPT-4o + Ads library

Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.

Try it free

#Education

Hello everyone, my name is Zak, and welcome to our YouTube channel. In this article, we will discuss the Infosys Specialist Programmer role, focusing on the recent coding test that candidates have taken. Many of the questions from the test were difficult, ranging from hard to very hard levels, with some candidates fortunate enough to encounter average or medium difficulty questions. The tough nature of the exam gave rise to various coding challenges that we are going to examine today.

**Understanding the Exam Structure**
Most candidates participated in the test during the window from 11 AM to 2 PM. While some received manageable questions, others faced challenging dynamic programming problems. This article aims to explore and provide insight into some of those coding questions, along with code snippets and explanations, so that you can prepare effectively for future exams.

**Overview of Coding Problems**

We have compiled a list of six to seven questions that have been circulating among candidates. I'll be presenting the first question, "Permutation Swaps," and providing details on the logic and coding involved.

The problem states that you are given a permutation ( P ) of length ( n ), representing a graph of ( n ) nodes with edges from each node ( i ) to ( P[i] ). The challenge is to find the total number of pairs of indices ( (i, j) ) such that swapping ( P[i] ) and ( P[j] ) results in the maximum possible longest path in the graph.

**Input Format**

- The first line contains an integer ( n ), the number of elements in ( P ).
- The next ( n ) lines consist of integers describing ( P[i] ).

**Sample Test Case**

- For the input
`3 1 2 3`

, the output is`3`

.

**Explanation**
Swapping ( P[1] ) and ( P[2] ) generates new paths, resulting in multiple permutations, showcasing the logic needed for the answer.

**Code Example**

```
def get_user_arr(P):
# Logic to compute user array
pass
def count_sa(P):
# Logic to count pairs for swaps
pass
## Introduction
```

This particular code passed 4 out of the 13 test cases, highlighting the challenging nature of timing and conditions in such coding scenarios.

This problem involves a bracket sequence, and the goal is to determine how many operations can be performed to make the sequence regular after flipping brackets up to ( K ) times.

**Sample Input**

`2 1`

- Output will be
`2`

.

**Code Sample**

```
def count_sequences(s):
# Logic for counting valid bracket sequences
pass
```

This code faced similar challenges with timing.

You are tasked with finding the number of good subarrays such that each element appears either ( K ) times or zero times.

**Sample Input**

`5 2`

with array`[5, 5, 2, 3, 2]`

yields an output of`1`

.

- String Comparison
- AB String
- Increasing Array Logic

Overall, candidates found that only specific approaches and algorithms worked for the higher difficulty questions.

**Conclusion**
The questions encountered were challenging and could benefit from thorough practice in data structures and algorithms. Candidates should prepare accordingly for future assessments.

I will compile additional questions and solutions into a Google Document that I will link in the description. Don't forget to subscribe to our channel for more insights!

Coding questions, Infosys, Specialist Programmer role, permutation swaps, bracket sequence, dynamic programming, good subarrays, string comparison, job preparation.

**Q1: What is the difficulty level of the Infosys Specialist Programmer exam?**

A1: The exam has a range of questions from hard to very hard levels.

**Q2: Are all candidates expected to get difficult questions?**

A2: Yes, candidates reported facing tough questions regardless of their experience level.

**Q3: How can I prepare for the coding questions?**

A3: Familiarize yourself with data structures and algorithms, and practice solving previous years' coding questions.

**Q4: Will you be providing solutions to all the questions?**

A4: Yes, detailed solutions and explanations will be provided in a Google Document linked in the description.

In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

TopView.ai provides two powerful tools to help you make ads video in one click.

Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

You may also like