We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fc747c commit ee1fe13Copy full SHA for ee1fe13
defragmenting_ip_address.cpp
@@ -0,0 +1,16 @@
1
+class Solution {
2
+public:
3
+ string split(string s){
4
+ string new_str = "";
5
+ for(auto it=s.begin(); it!=s.end();it++){
6
+ if(*it != '.')
7
+ new_str+= *it;
8
+ else if(*it == '.')
9
+ new_str += "[.]";
10
+ }
11
+ return new_str;
12
13
+ string defangIPaddr(string address){
14
+ return split(address);
15
16
+};
hamming_distance.cpp
@@ -0,0 +1,17 @@
+ int hammingDistance(int x, int y) {
+ int op1, op2;
+ long long int distance = 0;
+ while(x > 0 || y > 0){
+ op1 = x % 2;
+ op2 = y % 2;
+ distance += (op1 ^ op2);
+ x /= 2;
+ y /= 2;
+ cout<<distance<<"\n";
+ cout<<x<<y;
+ return distance;
17
0 commit comments