java.lang.Object
g2501_2600.s2525_categorize_box_according_to_criteria.Solution

public class Solution extends Object
2525 - Categorize Box According to Criteria.<p>Easy</p> <p>Given four integers <code>length</code>, <code>width</code>, <code>height</code>, and <code>mass</code>, representing the dimensions and mass of a box, respectively, return <em>a string representing the <strong>category</strong> of the box</em>.</p> <ul> <li>The box is <code>&quot;Bulky&quot;</code> if: <ul> <li><strong>Any</strong> of the dimensions of the box is greater or equal to <code>10<sup>4</sup></code>.</li> <li>Or, the <strong>volume</strong> of the box is greater or equal to <code>10<sup>9</sup></code>.</li> </ul> </li> <li>If the mass of the box is greater or equal to <code>100</code>, it is <code>&quot;Heavy&quot;.</code></li> <li>If the box is both <code>&quot;Bulky&quot;</code> and <code>&quot;Heavy&quot;</code>, then its category is <code>&quot;Both&quot;</code>.</li> <li>If the box is neither <code>&quot;Bulky&quot;</code> nor <code>&quot;Heavy&quot;</code>, then its category is <code>&quot;Neither&quot;</code>.</li> <li>If the box is <code>&quot;Bulky&quot;</code> but not <code>&quot;Heavy&quot;</code>, then its category is <code>&quot;Bulky&quot;</code>.</li> <li>If the box is <code>&quot;Heavy&quot;</code> but not <code>&quot;Bulky&quot;</code>, then its category is <code>&quot;Heavy&quot;</code>.</li> </ul> <p><strong>Note</strong> that the volume of the box is the product of its length, width and height.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> length = 1000, width = 35, height = 700, mass = 300</p> <p><strong>Output:</strong> &ldquo;Heavy&rdquo;</p> <p><strong>Explanation:</strong></p> <p>None of the dimensions of the box is greater or equal to 10<sup>4</sup>.</p> <p>Its volume = 24500000 <= 10<sup>9</sup>. So it cannot be categorized as &ldquo;Bulky&rdquo;.</p> <p>However mass >= 100, so the box is &ldquo;Heavy&rdquo;.</p> <p>Since the box is not &ldquo;Bulky&rdquo; but &ldquo;Heavy&rdquo;, we return &ldquo;Heavy&rdquo;.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> length = 200, width = 50, height = 800, mass = 50</p> <p><strong>Output:</strong> &ldquo;Neither&rdquo;</p> <p><strong>Explanation:</strong></p> <p>None of the dimensions of the box is greater or equal to 10<sup>4</sup>.</p> <p>Its volume = 8 * 10<sup>6</sup> <= 10<sup>9</sup>. So it cannot be categorized as &ldquo;Bulky&rdquo;.</p> <p>Its mass is also less than 100, so it cannot be categorized as &ldquo;Heavy&rdquo; either.</p> <p>Since its neither of the two above categories, we return &ldquo;Neither&rdquo;.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= length, width, height <= 10<sup>5</sup></code></li> <li><code>1 <= mass <= 10<sup>3</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • categorizeBox

      public String categorizeBox(int length, int width, int height, int mass)