Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b3ed004

Browse files
committed
Added README.md file for Power of Three
1 parent 862adeb commit b3ed004

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

‎326-power-of-three/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h2><a href="https://leetcode.com/problems/power-of-three">Power of Three</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Given an integer <code>n</code>, return <em><code>true</code> if it is a power of three. Otherwise, return <code>false</code></em>.</p>
2+
3+
<p>An integer <code>n</code> is a power of three, if there exists an integer <code>x</code> such that <code>n == 3<sup>x</sup></code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> n = 27
10+
<strong>Output:</strong> true
11+
<strong>Explanation:</strong> 27 = 3<sup>3</sup>
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> n = 0
18+
<strong>Output:</strong> false
19+
<strong>Explanation:</strong> There is no x where 3<sup>x</sup> = 0.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> n = -1
26+
<strong>Output:</strong> false
27+
<strong>Explanation:</strong> There is no x where 3<sup>x</sup> = (-1).
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>-2<sup>31</sup> &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
35+
</ul>
36+
37+
<p>&nbsp;</p>
38+
<strong>Follow up:</strong> Could you solve it without loops/recursion?

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /