-
Notifications
You must be signed in to change notification settings - Fork 150
Add Python implementations for Day 18 and Day 19 problems as well as Ruby implementation for Day 20 problem #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
131 commits
Select commit
Hold shift + click to select a range
248bea9
Add @aaditkamat as a contributor
85abd67
Add Ruby code for Day 1: FizzBuzz problem
0c80762
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
76cf6c5
Add Ruby code for Day 2: String reverse problem
39210a0
Update README.md for Day 2
64a0ca2
Modify Ruby code and README
ab743a6
Add condition for nil and wrong type edge cases
48e33c7
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
bdeefe5
Add a seperate Ruby source code file for palindrome
fc41b6a
Modify code for reverse.rb
784ee39
Add seperate palindrome and reverse code sections in README
b24fa8c
Update gitignore
b40d361
Refactor palindrome.rb and rename heading in README
763683a
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
5f1a01d
Add solution for Day 3: Hamming Problem
8d37216
Add condition for strings of unequal lengths
3183f2d
Update README
08c9ca1
Change project name and owner in.all-contributorsrc
6350c3f
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
af34b2a
Remove merge conflict lines
e07c5f1
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
c3d05d6
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
6db4527
Add @shivank86 as a contributor
3667ef7
Merge remote-tracking branch 'upstream/master'
6ff55a0
Merge branch 'master' of github.com:aaditkamat/dailycodebase
e4ea3ad
Add C++ files for different patterns
a46eeab
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
b74a9e5
Add author and date comments at the top of C++ files
0d16771
Update README.md
a0879ef
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
8bf3f5b
Merge branch 'master' into master
f0527fc
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
543d167
Add solution for Day 6 Problem in Python
9d7d81f
Update README
46dbf7b
Refactor code files
cc40fc8
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
1134c2d
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
bb3ab0c
Modify string representation of output in python files
d96703e
Add Ruby solutions for Day 6 problem
c2c91da
Update README for Ruby code
ceadf27
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
c1cbccb
Merge branch 'master' of github.com:aaditkamat/dailycodebase
2e855d2
Add first version of solutions for Day 7 problem in C++, Java & Ruby
d9a1e8c
Modify solutions
5f16c38
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
5499b34
Update Day 7 README
96b645f
Remove merge conflicts from CONTRIBUTORS.md
815d24e
Add back removed lines in CONTRIBUTORS.md
12443c2
Merge branch 'master' into master
0d95ea5
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
1e45c12
Merge branch 'master' of github.com:aaditkamat/dailycodebase
38724d2
Add code sections contributed by @imkaka to day 6 README
0cc23ba
Update README.md
MadhavBahl 5c74b48
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
2f5c30d
Merge branch 'master' of github.com:aaditkamat/dailycodebase
3ddedb4
Add C++ solution
b84a4d4
Add Day 8 solution in C++
26f256c
Add Day 8 solution in Java
905596d
Add Day 8 solution in Ruby
a457d3c
Add Day 8 solution in Python
873cc51
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
f1a18c3
Add credits at the top of the code
a283abf
Update README
486b459
Update C++ implementation
c4c0f9d
Update Python implementation
ef2afe7
Merge branch 'master' into master
35a928f
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
f5b8355
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
23f8eea
Merge remote-tracking branch 'origin/master'
61b941f
Add solution for Day 10: String Permutation Problem in Python
cee4779
Update Day 10 README
1e7be81
Merge branch 'master' into master
MadhavBahl 08da228
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
daf1625
Merge remote-tracking branch 'origin/master'
f97ce93
Change heading in README and remove empty directory in day 9
a0f88dc
Merge pull request #1 from CodeToExpress/master
f1e7f00
Update README.md
MadhavBahl 2811166
Merge branch 'master' into master
MadhavBahl 537062c
Merge master branch of CodeToExpress/dailycodebase into master branch…
2636dc6
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
b3ee288
Add Ruby solutions for Day 13
dc8fe63
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
8df29df
Update README
e9c2cef
Add credits to the code
dcc1b87
Add Python solution for Day 13
4ce5d73
Update Day 13 README
38e180b
Update fibonacci.py
2213514
Modify Fibonacci python code section in day 13 README
0deaaf4
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
5e8b5d5
Merge remote-tracking branch 'origin/master'
3eae5c2
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
84c49f5
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
5758d99
Add Ruby solution to Day 16 problem
3cf81e5
Update Day 16 README with Ruby implementation
d4e98e9
Change wording of print statement
ca423b9
Merge branch 'master' into master
MadhavBahl 6011f87
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
0b34d25
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
438887f
Add Python solution to Day 17 problem
54f6d4f
Add Python implementation to Day 17 README
0eee5ba
Merge remote-tracking branch 'origin/master'
ab956d9
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
1ab5ae7
Merge pull request #4 from CodeToExpress/master
d0a9d5d
Merge pull request #5 from aaditkamat/day-18
d93291b
Add solution to Day 18 Question A: Frequency Counter
45c5082
Merge branch 'master' into master
MadhavBahl bb7a8bd
Add solution to Day 18 Question B: Count Uniques
7eebd06
Add solution to Day 18 Question C: Check Power N
79988b9
Merge branch 'master' of https://github.com/CodeToExpress/dailycodeba…
37af7b0
Update day 18 README with personal Python solution
a660086
Update check_power_n.py
bc1b5bb
Update count_uniques.py
7be2582
Merge branch 'day-18'
fd7580f
Merge branch 'master' of github.com:aaditkamat/dailycodebase
a97173b
Add Python implementation for Day 19 and update Day 18 solutions
b012425
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
8af374c
Add Ruby solution for Day 20 problem
2d7c8d2
Update Day 20 README with Ruby solution
19a8a06
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
3d374aa
Merge branch 'master' of https://github.com/CodeToExpress/dailycodebase
0d6908a
Add C++ solution and test cases for day 28 problem
5ab5a04
Add credits and brief explanation
7c610ea
Add C++ solution to day 28 README
57bd470
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
2c0cb76
Merge branch 'master' of github.com:aaditkamat/dailycodebase
76766ea
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
f4d52f5
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
f8b2dc7
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
0e1eab6
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
69c7f0d
Merge branch 'master' of github.com:CodeToExpress/dailycodebase
ccb70ab
Merge branch 'master' of github.com:CodeToExpress/dailycodebase into …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 2 | ||
| 1 2 3 4 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 7 | ||
| 1 2 3 4 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #include<iostream> | ||
|
|
||
| /** | ||
| * @author: aaditkamat | ||
| * @date: 28/1/2019 | ||
| */ | ||
|
|
||
| /* | ||
| * The input is assumed to be of the following form: | ||
| * The first line contains the number to be searched | ||
| * The second line contains the numbers to be searched seperated by spaces. | ||
| */ | ||
| int main() { | ||
| int num; | ||
| std::cin >> num; | ||
| int ctr = 0; | ||
| bool flag = false; | ||
| while (!std::cin.eof()) { | ||
| int value; | ||
| std::cin >> value; | ||
| if (value == num) { | ||
| std::cout << ctr << std::endl; | ||
| flag = true; | ||
| } | ||
| ctr++; | ||
| } | ||
| if (!flag) { | ||
| std::cout << "undefined" << std::endl; | ||
| } | ||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| clear | ||
| g++ solution.cpp -std=gnu++17 | ||
|
|
||
| if [ $? -eq 0 ]; then | ||
| DIR=rationalsequence2 | ||
|
|
||
| for i in {1..2} | ||
| do | ||
| ./a.out < ${DIR}/sample00${i}.in > ${DIR}/sample00${i}.o && diff ${DIR}/sample00${i}.o ${DIR}/sample00${i}.ans | ||
| open ${DIR}/sample00${i}.o | ||
| done | ||
| fi | ||
|
|
||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,55 @@ | ||
| /** | ||
| * @author: Karthick < karthikn2099@gmail.com > | ||
| * @github: https://github.com/karthikn2098 | ||
| * @date: 31/01/2018 | ||
| */ | ||
|
|
||
| #include <iostream> | ||
| using namespace std; | ||
|
|
||
| /** @desc: splits the array into two sections at each step, then checks the element in the desired one. | ||
| * @param: array , key (to be found), size of the array. | ||
| * @return: index of key if present , -1 otherwise. | ||
| * @TimeComplexity: O( logn ) < n = size of the array > | ||
| */ | ||
| int Binary_search(int arr[] , int key, int N) { | ||
| /* | ||
| * @author : imkaka | ||
| * @date : 31/1/2019 | ||
| */ | ||
|
|
||
| int low = 0 , high = N-1 , mid; | ||
| #include<iostream> | ||
| #include<cstdio> | ||
|
|
||
| while(low <= high) { | ||
| using namespace std; | ||
|
|
||
| mid = low + (high - low) / 2; //like (low + high)/2 but efficient. | ||
| int binary_search_itr(int arr[], int size, int val){ | ||
| int l = 0, r = size-1; | ||
| int mid = (l + r) / 2; | ||
|
|
||
| if(key == arr[mid]) { | ||
| return mid; | ||
| } | ||
| else if( key > arr[mid] ) { | ||
| low = mid + 1; | ||
| while(arr[mid] != val && l <= r){ | ||
| if(val < arr[mid]){ | ||
| r = mid - 1; | ||
| } | ||
| else { | ||
| high = mid - 1; | ||
| else{ | ||
| l = mid +1; | ||
| } | ||
|
|
||
| mid = (l + r) / 2; | ||
| } | ||
|
|
||
| if(arr[mid] == val) | ||
| return mid; | ||
|
|
||
| return -1; | ||
| } | ||
|
|
||
| int main(void) { | ||
|
|
||
| int arr[] = { 1, 3, 5, 7, 8, 9, 100, 234, 788, 899 }; | ||
| int binary_search_rec(int arr[], int left, int right, int val){ | ||
| if(right >= left){ | ||
|
|
||
| int sizeOfArray = sizeof(arr) / sizeof(arr[0]); | ||
| int mid = left + (right - left) / 2; | ||
|
|
||
| cout << "\nBinary_search(arr , 100) = " << Binary_search(arr, 100, sizeOfArray ) << endl; | ||
| if(arr[mid] == val) return mid; | ||
|
|
||
| cout << "\nBinary_search(arr , 1000) = " << Binary_search(arr, 1000, sizeOfArray ) << endl; | ||
| if(arr[mid] > val) | ||
| return binary_search_rec(arr, left, mid-1, val); | ||
| return binary_search_rec(arr, mid+1, right, val); | ||
| } | ||
|
|
||
| return 0; | ||
| return -1; | ||
| } | ||
|
|
||
| /* | ||
| --------------- | ||
| Sample Output | ||
| --------------- | ||
|
|
||
| Binary_search(arr , 100) = 6 | ||
| int main(){ | ||
|
|
||
| Binary_search(arr , 1000) = -1 | ||
|
|
||
| */ | ||
| int arr[] = {1, 2, 3, 6, 9, 15, 16, 14}; | ||
| int val = 9; | ||
| int size = sizeof(arr)/sizeof(arr[0]); | ||
| cout << "Iterative: " << binary_search_itr(arr, size, val) << endl; | ||
| cout << "Recursive: " << binary_search_rec(arr, 0, size-1, val) << endl; | ||
| return 0; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove all the indentations?