#### 【例题1】LCR 190. 加密运算 - 力扣（LeetCode）

``````int encryptionCalculate(int dataA, int dataB) {
while(dataB!=0){
unsigned int temp = (unsigned int)(dataA&dataB)<<1;
dataA = dataA^dataB;
dataB = temp;
}
return dataA;
}``````

#### 【例题2】面试题 08.05. 递归乘法 - 力扣（LeetCode）

``````int multiply(int A, int B){
if(A>B){
if(B==1){
return A;
}
return A+multiply(A,B-1);
}else{
if(A==1){
return B;
}
return B+multiply(A-1,B);
}

}``````

#### 【例题3】29. 两数相除 - 力扣（LeetCode）

``````int divide(int dividend, int divisor){
int flag = 0;
long ans = 1;
long dend = dividend;
long sor = divisor;
if(!((dend>0&&sor>0)||(dend<0&&sor<0))) flag = 1;
dend = dend<0?-dend:dend;
sor = sor<0?-sor:sor;
if(dend < sor) return 0;
//计算商值
long sum = sor;
while(sum < dend){
sum += sum;
ans = ans<<1;
}
long temp = sor;
long pos = 1;
while(sum>dend){
sum -= temp;
temp = temp<<1;
ans -= pos;
pos = pos<<1;
}
while(sum+sor<= dend){
sum+=sor;
ans++;
}

if(dend == sor) ans = 1;
if(flag) ans = -ans;
if(ans > INT_MAX) ans = INT_MAX;
if(ans < INT_MIN) ans = INT_MIN;
return ans;
}``````

#### 【例题4】力扣（LeetCode）官网 - 全球极客挚爱的技术成长平台

``````bool isSameAfterReversals(int num){
if(num == 0)return true;
if(num % 10 == 0) return false;
if(num>10 && num/10 == 0)  return false;
if(num>100000 && num/100000 == 0) return false;
if(num>10000 && num/10000 == 0) return false;
if(num>1000 && num/1000 == 0) return false;
if(num>100 && num/100 == 0) return false;
if(num>10 && num/10 == 0) return false;
return true;
}``````

#### 【例题5】69. x 的平方根 - 力扣（LeetCode）

``````int mySqrt(int x){
if(x == 0) return 0;
if(x == 1) return 1;
// 二分查找
int right = x>>1,left = 1;
long mid;
while(left <= right){
mid = left + ((right - left + 1) >> 1);
if( mid * mid == x ) return mid;
if( mid * mid < x) left = mid + 1;
if(mid * mid > x) right = mid -1;
}
return left-1;
}``````