subject
Computers and Technology, 03.12.2020 16:30 WTDjase

Given an array of positive integers a, your task is to calculate the sum of every possible a[i] ∘a[j], where a[i]∘a[j] is the concatenation of the string representations of a[i] and a[j] respectively. ExampleFor a = [10, 2], the output should be concatenationsSum(a) = 1344.a[0] ∘a[0] = 10 ∘10 = 1010,a[0] ∘a[1] = 10 ∘2 = 102,a[1] ∘a[0] = 2 ∘10 = 210,a[1] ∘a[1] = 2 ∘2 = 22.So the sum is equal to 1010 + 102 + 210 + 22 = 1344.For a = [8], the output should be concatenationsSum(a) = 88.There is only one number in a, and a[0] ∘a[0] = 8 ∘8 = 88, so the answer is 88.Input/Output[execution time limit] 3 seconds (java)[input] array. integer aA non-empty array of positive integers. Guaranteed constraints:1 ≤ a. length ≤ 105,1 ≤ a[i] ≤ 106.[output] integer64The sum of all a[i] ∘a[j]s. It's guaranteed that the answer is less than 253.[Java] Syntax Tips

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:30, ashleypere99
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
image
Computers and Technology, 23.06.2019 20:50, terryhgivens5349
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
image
Computers and Technology, 24.06.2019 02:30, journeyhile5
How to apply the fly in effect to objects on a slide
Answers: 1
image
Computers and Technology, 24.06.2019 12:30, nomood
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
You know the right answer?
Given an array of positive integers a, your task is to calculate the sum of every possible a[i] ∘a[j...

Questions in other subjects:

Konu
Mathematics, 20.10.2019 20:00