File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change 11package com .fishercoder .solutions ;
22
3- /**
4- * 693. Binary Number with Alternating Bits
5- *
6- * Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.
7-
8- Example 1:
9- Input: 5
10- Output: True
11- Explanation:
12- The binary representation of 5 is: 101
13-
14- Example 2:
15- Input: 7
16- Output: False
17- Explanation:
18- The binary representation of 7 is: 111.
19-
20- Example 3:
21- Input: 11
22- Output: False
23- Explanation:
24- The binary representation of 11 is: 1011.
25-
26- Example 4:
27- Input: 10
28- Output: True
29- Explanation:
30- The binary representation of 10 is: 1010.
31- */
32-
333public class _693 {
344 public static class Solution1 {
355 public boolean hasAlternatingBits (int n ) {
You can’t perform that action at this time.
0 commit comments