Vasya faced a serious problem: he has to work with a bunch of numbers. Since he has to print them out, he wants to use as little paper as possible. And that is why he came up with the following idea: convert array of numbers into a string by the following rule:   Converted each number to the base 26. To write a number, Vasya will use lowercase letters of Latin alphabet: 'a' = 0, 'b' = 1, ..., 'z' = 25;   Find the longest of the strings obtained by the conversion;   Transform all strings shorter than the longest one, by prepending as many "a" as required in front of the string, so their length is equal.;   Combine all strings into one by the order in which they were converted from left to right in the input;   Subtract one from the maximum length we found before, and convert it to base 26. Then prepend it to the resulting string.   Your task is to convert the given array arr to a string as Vasya suggests.   Check out the following example for better understanding.   Example For arr = [1, 28, 55], the output should be "babbccd".   Here's how the numbers are converted:   1 = "b"; 28 = "bc"; 55 = "cd". Since the longest string is of length 2, number 1 should be turned into "ab".   The final answer is "babbccd", where:   - the first letter 'b' stands for the length of the longest string; - the next two letters "ab" stand for the first number; - the following two letters "bc" stand for the second number; - the last two letters "cd" stand for the last number. Input/Output [input] integer array arr   Array of integers.   1 ≤ a.length ≤ 100   1 ≤ a[i] ≤ 10^9   [output] a string   A string into which arr is converted.     Solve it in C# please

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Vasya faced a serious problem: he has to work with a bunch of numbers. Since he has to print them out, he wants to use as little paper as possible. And that is why he came up with the following idea: convert array of numbers into a string by the following rule:

 

Converted each number to the base 26. To write a number, Vasya will use lowercase letters of Latin alphabet: 'a' = 0, 'b' = 1, ..., 'z' = 25;

 

Find the longest of the strings obtained by the conversion;

 

Transform all strings shorter than the longest one, by prepending as many "a" as required in front of the string, so their length is equal.;

 

Combine all strings into one by the order in which they were converted from left to right in the input;

 

Subtract one from the maximum length we found before, and convert it to base 26. Then prepend it to the resulting string.

 

Your task is to convert the given array arr to a string as Vasya suggests.

 

Check out the following example for better understanding.

 

Example

For arr = [1, 28, 55], the output should be "babbccd".

 

Here's how the numbers are converted:

 

1 = "b";

28 = "bc";

55 = "cd".

Since the longest string is of length 2, number 1 should be turned into "ab".

 

The final answer is "babbccd", where:

 

- the first letter 'b' stands for the length of the longest string;

- the next two letters "ab" stand for the first number;

- the following two letters "bc" stand for the second number;

- the last two letters "cd" stand for the last number.

Input/Output

[input] integer array arr

 

Array of integers.

 

1 ≤ a.length ≤ 100

 

1 ≤ a[i] ≤ 10^9

 

[output] a string

 

A string into which arr is converted.

 

 

Solve it in C# please 

Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education