当前位置:网站首页>Baidu interview question - judge whether a positive integer is to the power of K of 2
Baidu interview question - judge whether a positive integer is to the power of K of 2
2022-07-24 20:43:00 【Chen Yikang】
The code is as follows :
import java.util.Scanner;
public class test{
// Determine whether a positive integer is 2 Of K Power
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int input = scanner.nextInt();
if((input & (input - 1)) == 0){
System.out.println("Yes!");
}
else{
System.out.println("No!");
}
}
}analysis :

边栏推荐
- Opengl rendering pipeline
- Oracle 19C datagruad replication standby rman-05535 ora-01275
- Synthesis route of ALA PNA alanine modified PNA peptide nucleic acid | AC ala PNA
- Methods of using tyrosine modified peptide nucleic acid PNA | Tyr PNA | BZ Tyr PNA | 99Tcm survivinmrna antisense peptide nucleic acid
- Azide labeled PNA peptide nucleic acid | methylene blue labeled PNA peptide nucleic acid | tyrosine modified PNA | Tyr PNA Qiyue Bio
- Each blogger needs to ask himself seven basic questions
- Fluoronisin peptide nucleic acid oligomer complex | regular active group alkyne, SH thiol alkynyl modified peptide nucleic acid
- Oracle creates table spaces and views table spaces and usage
- Upgrade appium automation framework to the latest 2.0
- [advanced data mining technology] Introduction to advanced data mining technology
猜你喜欢

Do you want to enroll in a training class or study by yourself?

How to test WebService interface

Opencv learning Day2

Two methods of how to export asynchronous data

Summary of yarn capacity scheduler

API data interface of A-share transaction data

Easy to use office network optimization tool onedns

Understand the domestic open source Magnolia license series agreement in simple terms

Fluoronisin peptide nucleic acid oligomer complex | regular active group alkyne, SH thiol alkynyl modified peptide nucleic acid

147-利用路由元信息设置是否缓存——include和exclude使用——activated和deactivated的使用
随机推荐
[msp430g2553] graphical development notes (1) configuration environment
The difference between token and session, this classic interview question deserves a more in-depth answer
Istio II traffic hijacking process
Markdown to PDF API data interface
PHP page Jump mode
The U.S. economy continues to be weak, and Microsoft has frozen recruitment: the cloud business and security software departments have become the hardest hit
Home Assistant中接入博联WiFi智能遥控
Pressing Ctrl will cause several key press messages
Leetcode 1928. minimum cost of reaching the destination within the specified time
250 million, Banan District perception system data collection, background analysis, Xueliang engineering network and operation and maintenance service project: Chinatelecom won the bid
[summary of Feature Engineering] explain what features are and the steps of feature engineering
Flink Window&Time 原理
Solution: 2003 cant connect to MySQL server on * * * * and use near 'identified by' * * * * 'with grant option' at
Framework API online viewing source code
C form application treeview control use
Huawei set up login with account and password
Quick sort
Merge sort
Selenium is detected as a crawler. How to shield and bypass it
Application layer - typical protocol analysis