-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7_problemSolving.cpp
More file actions
58 lines (50 loc) · 992 Bytes
/
7_problemSolving.cpp
File metadata and controls
58 lines (50 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 1 Reverse Integer
// #include <iostream>
// # include <math.h>
// using namespace std;
// int main(){
// int n,x;
// cin>> n;
// while(n>0){
// if(x<(-(pow(2,31))) || x>(pow(2,31))-1){
// cout<< "0";
// }
// x=n%10;
// n/=10;
// cout<< x;
// }
// }
// 2 Compliment Base 10 Integer
// #include <iostream>
// #include <math.h>
// using namespace std;
// int main()
// {
// int n, ans, mask = 0;
// cin >> n;
// if(n==0){
// cout<< 0 ;
// }
// while(n!=0){
// n>>=1;
// mask=n|1;
// mask<<=1;
// }
// ans=(~n) & mask;
// cout<< ans;
// }
// 3 Power of Two
// #include <iostream>
// #include <math.h>
// using namespace std;
// int main(){
// int n ;
// cin>>n;
// for(int i=0;i<31;i++){
// int s=(pow(2,i));
// if(s==n){
// cout<< "true";
// }
// }
// cout<< "false";
// }