c盤清理的步驟是什么(如何清理C盤空間)
如何清理C盤空間怎么清理C盤的垃圾文件?每天上網(wǎng)會給電腦帶來很多臨時(shí)文件,這些垃圾文件不清理掉時(shí)間久了就會影響到電腦的運(yùn)行速度。那怎
2022/12/08
(資料圖片僅供參考)
題目:
整數(shù)轉(zhuǎn)換。編寫一個(gè)函數(shù),確定需要改變幾個(gè)位才能將整數(shù)A轉(zhuǎn)成整數(shù)B。
示例1:
輸入:A = 29 (或者0b11101), B = 15(或者0b01111) 輸出:2
示例2:
輸入:A = 1,B = 2 輸出:2
代碼實(shí)現(xiàn):
class Solution { public int convertInteger(int A, int B) { int temp = A ^ B; int count = 0; while (temp != 0) { temp &= (temp - 1); // 去掉二進(jìn)制表示的最右邊的1 count++; } return count; }}
標(biāo)簽: 整數(shù)轉(zhuǎn)換