Skip to content

Commit da11fad

Browse files
committed
Create README - LeetHub
1 parent 912c406 commit da11fad

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<h2><a href="https://leetcode.com/problems/guess-number-higher-or-lower">374. Guess Number Higher or Lower</a></h2><h3>Easy</h3><hr><p>We are playing the Guess Game. The game is as follows:</p>
2+
3+
<p>I pick a number from <code>1</code> to <code>n</code>. You have to guess which number I picked.</p>
4+
5+
<p>Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.</p>
6+
7+
<p>You call a pre-defined API <code>int guess(int num)</code>, which returns three possible results:</p>
8+
9+
<ul>
10+
<li><code>-1</code>: Your guess is higher than the number I picked (i.e. <code>num &gt; pick</code>).</li>
11+
<li><code>1</code>: Your guess is lower than the number I picked (i.e. <code>num &lt; pick</code>).</li>
12+
<li><code>0</code>: your guess is equal to the number I picked (i.e. <code>num == pick</code>).</li>
13+
</ul>
14+
15+
<p>Return <em>the number that I picked</em>.</p>
16+
17+
<p>&nbsp;</p>
18+
<p><strong class="example">Example 1:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> n = 10, pick = 6
22+
<strong>Output:</strong> 6
23+
</pre>
24+
25+
<p><strong class="example">Example 2:</strong></p>
26+
27+
<pre>
28+
<strong>Input:</strong> n = 1, pick = 1
29+
<strong>Output:</strong> 1
30+
</pre>
31+
32+
<p><strong class="example">Example 3:</strong></p>
33+
34+
<pre>
35+
<strong>Input:</strong> n = 2, pick = 1
36+
<strong>Output:</strong> 1
37+
</pre>
38+
39+
<p>&nbsp;</p>
40+
<p><strong>Constraints:</strong></p>
41+
42+
<ul>
43+
<li><code>1 &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
44+
<li><code>1 &lt;= pick &lt;= n</code></li>
45+
</ul>

0 commit comments

Comments
 (0)