Infosys Coding Questions PDF

Infosys Coding Questions PDF Download

Infosys Coding Questions PDF Download for free using the direct download link given at the bottom of this article.

Infosys Coding Questions PDF Details
Infosys Coding Questions
PDF Name Infosys Coding Questions PDF
No. of Pages 16
PDF Size 0.15 MB
Language English
Source pdffile.co.in
Download LinkAvailable ✔
If Infosys Coding Questions is a illigal, abusive or copyright material Report a Violation. We will not be providing its PDF or any source for downloading at any cost.

Infosys Coding Questions

Hey guys, today we are going to present Infosys Coding Questions PDF for all of you. If you are also looking for it to download in pdf format then you have arrived on the right page. Here in this post, we are providing the Infosys latest recruitment pattern and Infosys placement papers with a solution pdf which is very helpful for everyone.

Infosys Limited is an Indian multinational information technology company. It provides business consulting, information technology and outsourcing services. The company was founded in Pune. Candidates Can download the Infosys Placement Question Papers from the link which is available below on this post.

Infosys Coding Questions PDF 2022

Sections Number of questions Time Duration Expected marks per question
Reasoning Ability 15 25 mins 1
Verbal Ability 20 20 mins 1
Mathematical Ability 10 35 mins 1
Pseudocode 5 10 2
Puzzle Solving 4 10 Different for different questions (varies from 1 to 3)

Infosys Recruitment Details

Name Of The Company Infosys
Qualification Any Graduates/ Post Graduates
Job Location Across India
Category Placement Papers
Official Website www.infosys.com

Problem Statement :

You have been given a string S of length N. The given string is a binary string that consists of only 0’s and ‘1’s. The ugliness of a string is defined as the decimal number that this binary string represents.


  • “101” represents 5.
  • “0000” represents 0.
  • “01010” represents 10.

There are two types of operations that can be performed on the given string.

  • Swap any two characters by paying a cost of A coins.
  • Flip any character by paying a cost of B coins
  • flipping a character means converting a ‘1’to a ‘0’or converting a ‘0’ to a ‘1’.

Initially, you have been given coins equal to the value defined in CASH. Your task is to minimize the ugliness of the string by performing the above-mentioned operations on it. Since the answer can be very large, return the answer modulo 10^9+7.


  • You can perform an operation only if you have enough coins to perform it.
  • After every operation, the number of coins gets deducted from the cost for that operation.

Input Format

  • The first line contains an integer, N, denoting the number of characters in the string
  • The next line contains a string, S, denoting the binary string
  • The next line contains an integer, CASH, denoting the total number of coins present initially
  • Next will contains an integer, A, denoting the cost to swap two characters.
  • Then the next line contains an integer, B, denoting the cost to flip a character.


  • 1 <= N <= 10^5
  • 1< len(S)<= 10^5
  • 1<=CASH <=10^5
  • 1<=A<=10^5
  • 1<=B<=10^5

Sample Input 1 :


Sample Output 1 :



3 flips can be used to create “0001” which represents 1.

Sample Input 2:


Sample Output 2:



First swap 0 with the most significant 1, then use flip twice first on index one and then on index two “111011”=>”0111111″=>”001111″=>”000111″ the value represented is 7.

 Sample Input 3:


Sample Output 3:



Flip the 3 most significant characters to get “000011”: the value represented by this string is 3. N

You can download Infosys Coding Questions PDF by going through the following download button.

Infosys Coding Questions PDF Download Link

Report This
If the download link of Gujarat Manav Garima Yojana List 2022 PDF is not working or you feel any other problem with it, please Leave a Comment / Feedback. If Infosys Coding Questions is a illigal, abusive or copyright material Report a Violation. We will not be providing its PDF or any source for downloading at any cost.

Leave a Reply

Your email address will not be published.