Infosys Coding Questions PDF

Infosys Coding Questions PDF Download

Infosys Coding Questions PDF download link is given at the bottom of this article. You can direct download PDF of Infosys Coding Questions for free using the download button.

Infosys Coding Questions PDF Summary

Dear readers, here we are presenting Infosys Coding Questions PDF to all of you. Infosys Limited is an Indian multinational information technology company. Infosys deals in various segments and provides business consulting, information technology, and outsourcing services.

If you are a job seeker and want a prestigious job so that you can secure your career then you should definitely make a try Infosys. Here we are sharing some of the best Infosys Coding Questions that will be going to help you in your further process of attaining your dream job.

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.

 Example:

  • “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.

Note:

  • You can perform an operation only if you have enough number of 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.

Constraints

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

Sample Input 1 :

4
1111
7
1
2

Sample Output 1 :

1

Explanation:

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

Sample Input 2:

6
111011
7
1
3

Sample Output 2:

7

Explanation:

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:

6
111011
7
3
2

Sample Output 3:

3

Explanation:

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 clicking on the following download button.

Infosys Coding Questions pdf

Infosys Coding Questions PDF Download Link

REPORT THISIf the download link of Infosys Coding Questions PDF is not working or you feel any other problem with it, please Leave a Comment / Feedback. If Infosys Coding Questions is a copyright material Report This. We will not be providing its PDF or any source for downloading at any cost.

RELATED PDF FILES

Leave a Reply

Your email address will not be published. Required fields are marked *