Skip to content

Commit

Permalink
Day3 (#41)
Browse files Browse the repository at this point in the history
* Add @imkaka as a contributor

* Day 3 + Day2 README correction
  • Loading branch information
imkaka authored and MadhavBahl committed Dec 24, 2018
1 parent 3befec1 commit 0075efe
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 11 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTORS.md
@@ -1,4 +1,3 @@

[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors)
## Contributors

Expand Down
19 changes: 12 additions & 7 deletions Day2/README.md
Expand Up @@ -219,7 +219,7 @@ public class Reverse {

## C++ Implementation

### [Cpp Solution](./C++/reverseString.cpp)
### [C++ Solution](./C++/reverseString.cpp)

```cpp
/*
Expand All @@ -246,6 +246,9 @@ int main(){
}

cout << str << endl;
return 0;
}
```

## Python Implementation

Expand All @@ -268,7 +271,7 @@ print("Reverse of", Str, "=", Str[::-1])

```cpp
/**
* @author: Rajdeep Roy Chowdhury<rrajdeeproychowdhury@gmail.com>
* @author: Rajdeep Roy Chowdhury<rrajdeeproychowdhury@gmail.com>
* @github: https://github.com/razdeep
* @date: 21/12/2018
*/
Expand Down Expand Up @@ -327,7 +330,7 @@ void main(){
strcpy(Rev, Str);
reverse(Rev);
printf("Reverse = %s", Rev);
}
```
Expand Down Expand Up @@ -577,7 +580,7 @@ int main(){

return 0;
}

```

## Python Implementation

Expand Down Expand Up @@ -639,9 +642,11 @@ void main(){
}

```
##Python implementation
##String reversing and pallindrome checking(./python3/String_and_pallindrome.py)
``` Python
## Python implementation
### String reversing and pallindrome checking(./python3/String_and_pallindrome.py)
```python
"""
* @author Shashank
* @date 21/12/2018
Expand Down
32 changes: 32 additions & 0 deletions Day3/C++/hammingDistance.cpp
@@ -0,0 +1,32 @@
/*
* @author : imkaka
* @date : 24/12/2018
*/

#include<iostream>
#include<string>

using namespace std;

int main(){

string str1, str2;

cin >> str1 >> str2;

int dis = 0;
if(str1.size() != str2.size())
cout << "Not Valid Strings for Hamming Distance Problem!!" << endl;
else{

for(int i=0; i < str1.size(); ++i){

if(str1[i] != str2[i]) dis++;

}

cout << "Hamming Distance b/w " << str1 << " and " << str2 << " is " << dis << "." << endl;
}

return 0;
}
44 changes: 41 additions & 3 deletions Day3/README.md
Expand Up @@ -106,9 +106,9 @@ public class HammingDistance {
*/
#include<iostream>
#include<string>

using namespace std;

int hammingDistance(string first_word, string second_word) {
int count = 0;
if (first_word.size() != second_word.size()) {
Expand All @@ -121,7 +121,7 @@ public class HammingDistance {
}
return count;
}

int main() {
string first_word, second_word;
cout << "Enter the first word: ";
Expand All @@ -133,6 +133,44 @@ public class HammingDistance {
}
```
### [hamingDistance](./C++/hamingDistance.cpp)
```cpp
/*
* @author : imkaka
* @date : 24/12/2018
*/
#include<iostream>
#include<string>
using namespace std;
int main(){
string str1, str2;
cin >> str1 >> str2;
int dis = 0;
if(str1.size() != str2.size())
cout << "Not Valid Strings for Hamming Distance Problem!!" << endl;
else{
for(int i=0; i < str1.size(); ++i){
if(str1[i] != str2[i]) dis++;
}
cout << "Hamming Distance b/w " << str1 << " and " << str2 << " is " << dis << "." << endl;
}
return 0;
}
```

## C Implementation

### [hamming.c](./C/hamming.c)
Expand Down

0 comments on commit 0075efe

Please sign in to comment.