Login

Striver SDE Sheet Problems

Problem title

Difficulty

Avg time to solve

Compare Versions

Easy

10 mins

Rotting Oranges

Moderate

20 mins

Reverse Words In A String

Easy

10 mins

Cycle Detection in a Singly Linked List

Moderate

15 mins

Predecessor And Successor In BST

Easy

10 mins

Power of Two

Easy

15 mins

Largest BST subtree

Easy

10 mins

Convert A Given Binary Tree To Doubly Linked List

Moderate

15 mins

Bottom View Of Binary Tree

Moderate

10 mins

Longest Subarray Zero Sum

Easy

15 mins

Problem

Submissions

2

Avg. time to solve

15 min

Success Rate

85%

Problem Statement

```
The first line of input contains an integer ‘T’ representing the number of test cases. Then the test cases follow.
The only line of each test case contains an integer 'N'.
```

```
For each test case, the only line of output prints whether the integer ‘N’ is a power of 2 or not.
The output for each test case is in a separate line.
```

```
You do not need to print anything; it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
-2^31 <= N <= 2^31 - 1
Time Limit: 1sec
```

```
3
16
25
-2
```

```
true
false
false
```

```
For the first test case, 16 can be represented as 2^4. So, 16 is the power of two and hence true gets printed.
For the second test case, 25 can not be represented as 2^Kwhere 'K' is integer. So, false gets printed.
For the third test case, -2 can not be represented as 2^K where 'K' is integer. So, false gets printed.
```

```
2
1
10
```

```
true
false
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code