Largest number in given Array formed by repeatedly combining two same elements
Given an array arr[], the task is to find the largest number in given Array, formed by repeatedly combining two same elements. If there are no same elements in the array initially, then print the output as -1.Examples: Input: arr = {1, 1, 2, 4, 7, 8} Output: 16 Explanation: Repetition 1: Combine 1s