d l mcbride solutions for day 2 to day 6#380
d l mcbride solutions for day 2 to day 6#380d-l-mcbride wants to merge 5 commits intoCodeToExpress:masterfrom
Conversation
|
@aaditkamat or @MadhavBahl, sorry to bother you guys, but was trying to make the Hacktoberfest deadline for a couple of pull request. Could you add the "hacktoberfest-accepted" label to this. Thank you for your help! :) |
|
|
||
| fun hammingDistance(first: String, second: String ):Int { | ||
| var distance = 0 | ||
| for(i in first.indices) { |
There was a problem hiding this comment.
Need to verify that the two strings are of the same length before checking for the hamming distance between the two strings.
|
|
||
| val THREE_MID = "helllo" | ||
| val ONE_EACH = "abcd" | ||
| val FOUR_END = "byeeee" |
There was a problem hiding this comment.
You should ideally have test cases where the character appearing most frequently does not appear in consecutive positions.
| println() | ||
| } | ||
| } | ||
| fun patterThree(longestLine: Int){ |
There was a problem hiding this comment.
| fun patterThree(longestLine: Int){ | |
| fun patternThree(longestLine: Int){ |
| } | ||
| patternOne(5) | ||
| patternTwo(lines = 4) | ||
| patterThree(5) |
There was a problem hiding this comment.
| patterThree(5) | |
| patternThree(5) |
| } | ||
| fun patterThree(longestLine: Int){ | ||
| (1..(longestLine*2-1)).forEach {line -> | ||
| if(line<=5) (1..line).forEach { pos ->print("${pos} ") } else (1..(2*longestLine-line)).forEach {less ->print("${less} ") } |
There was a problem hiding this comment.
| if(line<=5) (1..line).forEach { pos ->print("${pos} ") } else (1..(2*longestLine-line)).forEach {less ->print("${less} ") } | |
| if(line<=longestLine) (1..line).forEach { pos ->print("${pos} ") } else (1..(2*longestLine-line)).forEach {less ->print("${less} ") } |
aaditkamat
left a comment
There was a problem hiding this comment.
I have suggested some changes. Also, next time send a PR for each problem you solve instead of combining all the solutions under one PR.
Please make sure you have done the following:
/Day<n>/<Language>//Day <n>/all-contributors-cli