Learn DSADSAContests
coding75 logo
LeetCode POTDPOTDSheets
coding75 Pro
coding75 logo
Dashboard
Learn DSA
Course RoadmapFlow
DSA Topic TreeNew 🚀
Contest SolutionsPractice
Practice Sheets
MasterclassesLive 👨🏻‍💻

coding75 ProPRO

Live Classes & Placement Guidance

coding75 logo

The premier developer platform for mastering Data Structures & Algorithms, exploring contest editorials, building ATS-ready resumes, and accelerating your tech career.

Connect & Community

DSA & Contests

  • Learn DSA
  • Contest Solutions
  • LeetCode POTDDaily
  • Practice Sheets
  • MasterclassesSoon

Interview Prep

  • Portfolio Projects
  • CS Fundamentals
  • System DesignSoon
  • Interview ExperiencesSoon
  • Mock InterviewsSoon

Career & Pro

  • Jobs & Internships
  • Resume BuilderATS
  • coding75 Pro
  • Submit Feedback
© 2026coding75•crackDSA™•Maa Lalita Edtech Private Limited. All Rights Reserved.
Privacy PolicyTerms & ConditionsContact Support
Registered Office: Kanpur 208021•Regional Office: Indiranagar, Bangalore, 560008
Maa Lalita Edtech Private Limited
Contests/CodeChef/Starters 131/Encrypt Value
PrevNext
CodeChefCodeChef
4 Star
Starters 131

Encrypt Value

SortingArrayMath
Loading...
Solve on CodeChef

Problem Statement

Official algorithmic problem description and constraints.

Open on CodeChef

You are given an array 𝐴 containing 𝑁 integers.

Consider the following process:

  • Let 𝑆=0 initially.
  • For each 𝑖 from 1 to 𝑁 in order, update 𝑆 to either (𝑆+𝐴𝑖) or (S×Ai​).
  • That is, either add 𝐴𝑖 to 𝑆 or multiply 𝑆 by 𝐴𝑖.

Before performing the process, you're allowed to freely rearrange the elements of 𝐴 as you like.

If you choose the rearrangement of 𝐴 and the sequence of operations optimally, what's the maximum possible value of 𝑆 that you can obtain?

This maximum value can be very large, so print it modulo 1^9+7?

Solutions & Walkthrough

Detailed video explanations, mathematical intuition, and clean C++ implementation code.

Connecting secure classroom stream...
Back to Starters 131
Previous ProblemNext Problem