Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Anyone please help me in solving this question.

Правка en1, от RaghavGupta22, 2022-10-28 10:53:25

Problem Description

You are given an array of size N.

Let us define the value of subsequence as the product of its elements.

Find the sum of values of all distinct subsequences. since the answer can be large return it modulo 10^9+7.

Constraints:

  • 1 <= N <= 10^5
  • 1 <= A[i] <= 10^6

Sample input:

  1. N = 3, A = [1,2,3] Ans = 23 There are 7 distinct subsequences 3, 2, 1, 3*2 = 6, 3*1 = 3, 2*1 = 2, 3*2*1 = 6 then 3+2+1+6+3+2+6 = 23.

  2. N = 3, A = [3, 2, 2] Ans = 27 There are 5 distinct subsequences

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский RaghavGupta22 2022-10-28 10:53:25 599 Initial revision (published)