Skip to content

Commit 49b75f4

Browse files
committed
Create README - LeetHub
1 parent 0685690 commit 49b75f4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

0227-basic-calculator-ii/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h2><a href="https://leetcode.com/problems/basic-calculator-ii">227. Basic Calculator II</a></h2><h3>Medium</h3><hr><p>Given a string <code>s</code> which represents an expression, <em>evaluate this expression and return its value</em>.&nbsp;</p>
2+
3+
<p>The integer division should truncate toward zero.</p>
4+
5+
<p>You may assume that the given expression is always valid. All intermediate results will be in the range of <code>[-2<sup>31</sup>, 2<sup>31</sup> - 1]</code>.</p>
6+
7+
<p><strong>Note:</strong> You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as <code>eval()</code>.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
<pre><strong>Input:</strong> s = "3+2*2"
12+
<strong>Output:</strong> 7
13+
</pre><p><strong class="example">Example 2:</strong></p>
14+
<pre><strong>Input:</strong> s = " 3/2 "
15+
<strong>Output:</strong> 1
16+
</pre><p><strong class="example">Example 3:</strong></p>
17+
<pre><strong>Input:</strong> s = " 3+5 / 2 "
18+
<strong>Output:</strong> 5
19+
</pre>
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= s.length &lt;= 3 * 10<sup>5</sup></code></li>
25+
<li><code>s</code> consists of integers and operators <code>(&#39;+&#39;, &#39;-&#39;, &#39;*&#39;, &#39;/&#39;)</code> separated by some number of spaces.</li>
26+
<li><code>s</code> represents <strong>a valid expression</strong>.</li>
27+
<li>All the integers in the expression are non-negative integers in the range <code>[0, 2<sup>31</sup> - 1]</code>.</li>
28+
<li>The answer is <strong>guaranteed</strong> to fit in a <strong>32-bit integer</strong>.</li>
29+
</ul>

0 commit comments

Comments
 (0)