Cardboard for Pictures Problem

Cardboard for Pictures Problem — ExecCode Medium DSA Practice

Solve the Cardboard for Pictures problem on ExecCode. Free online medium DSA practice in Binary Search. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Each picture is a square with the given side length. The same cardboard width w is added on all four sides, so a picture of side s covers (s + 2w) squared. Return the integer w that makes the pictures cover exactly area c. Return the cardboard width w. You are given: squares — squares c — c Return the cardboard width w. Copied from OA Lab Part 1.

Examples

Input {'squares': [2], 'c': 36}; Output 2. Input {'squares': [1], 'c': 9}; Output 1. Input {'squares': [6], 'c': 100}; Output 2

Constraints

Follow the statement. Use a 64-bit integer when values can overflow.

Practice Cardboard for Pictures free on ExecCode. Browse DSA problems, topic map, and placement guides.