From a3a3fbc2068364b9d4790d7d40e4ec5becdec828 Mon Sep 17 00:00:00 2001 From: Anthony Cicchetti Date: Sun, 4 Jun 2017 22:14:08 -0400 Subject: [PATCH] Kotlin - Anagram WIP --- .../.gradle/3.5/file-changes/last-build.bin | Bin 0 -> 1 bytes .../.gradle/3.5/taskHistory/taskHistory.lock | Bin 0 -> 17 bytes .../.gradle/buildOutputCleanup/built.bin} | 0 .../buildOutputCleanup/cache.properties | 2 + .../buildOutputCleanup/cache.properties.lock | 1 + kotlin/anagram/.idea/compiler.xml | 9 + kotlin/anagram/.idea/gradle.xml | 19 + .../libraries/Gradle__junit_junit_4_12.xml | 11 + ...Gradle__org_hamcrest_hamcrest_core_1_3.xml | 11 + ...Gradle__org_jetbrains_annotations_13_0.xml | 11 + ...g_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml | 11 + ...org_jetbrains_kotlin_kotlin_test_1_1_1.xml | 11 + ...tbrains_kotlin_kotlin_test_junit_1_1_1.xml | 11 + kotlin/anagram/.idea/misc.xml | 6 + kotlin/anagram/.idea/modules.xml | 10 + kotlin/anagram/.idea/modules/anagram_main.iml | 40 + kotlin/anagram/.idea/modules/anagram_test.iml | 46 + kotlin/anagram/.idea/workspace.xml | 899 ++++++++++++++++++ kotlin/anagram/README.md | 15 + kotlin/anagram/anagram.iml | 12 + kotlin/anagram/build.gradle | 28 + .../classes/main/Anagram$letterMap$2.class | Bin 0 -> 2452 bytes .../anagram/build/classes/main/Anagram.class | Bin 0 -> 5098 bytes .../build/classes/test/AnagramTest.class | Bin 0 -> 3600 bytes .../build/kotlin-build/caches/version.txt | 1 + kotlin/anagram/src/main/kotlin/.keep | 0 kotlin/anagram/src/main/kotlin/Anagram.kt | 28 + kotlin/anagram/src/test/kotlin/AnagramTest.kt | 84 ++ .../.gradle/3.5/file-changes/last-build.bin | Bin 0 -> 1 bytes .../.gradle/3.5/taskHistory/taskHistory.lock | Bin 0 -> 17 bytes .../.gradle/buildOutputCleanup/built.bin | 0 .../buildOutputCleanup/cache.properties | 2 + .../buildOutputCleanup/cache.properties.lock | 1 + kotlin/isogram/.idea/compiler.xml | 9 + kotlin/isogram/.idea/gradle.xml | 19 + .../libraries/Gradle__junit_junit_4_12.xml | 11 + ...Gradle__org_hamcrest_hamcrest_core_1_3.xml | 11 + ...Gradle__org_jetbrains_annotations_13_0.xml | 11 + ...g_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml | 11 + ...org_jetbrains_kotlin_kotlin_test_1_1_1.xml | 11 + ...tbrains_kotlin_kotlin_test_junit_1_1_1.xml | 11 + kotlin/isogram/.idea/misc.xml | 6 + kotlin/isogram/.idea/modules.xml | 10 + kotlin/isogram/.idea/modules/isogram_main.iml | 40 + kotlin/isogram/.idea/modules/isogram_test.iml | 46 + kotlin/isogram/.idea/workspace.xml | 878 +++++++++++++++++ kotlin/isogram/README.md | 21 + kotlin/isogram/build.gradle | 28 + .../isogram/build/classes/main/Isogram.class | Bin 0 -> 2770 bytes ...toFrequencyMap$$inlined$groupingBy$1.class | Bin 0 -> 2212 bytes .../build/classes/main/IsogramKt.class | Bin 0 -> 1482 bytes .../main/META-INF/isogram_main.kotlin_module | Bin 0 -> 31 bytes .../classes/test/IsogramTest$Companion.class | Bin 0 -> 2670 bytes .../build/classes/test/IsogramTest.class | Bin 0 -> 2304 bytes .../build/kotlin-build/caches/version.txt | 1 + kotlin/isogram/isogram.iml | 12 + kotlin/isogram/src/main/kotlin/.keep | 0 kotlin/isogram/src/main/kotlin/Isogram.kt | 9 + kotlin/isogram/src/test/kotlin/IsogramTest.kt | 33 + kotlin/pangram/.idea/workspace.xml | 80 +- 60 files changed, 2501 insertions(+), 26 deletions(-) create mode 100644 kotlin/anagram/.gradle/3.5/file-changes/last-build.bin create mode 100644 kotlin/anagram/.gradle/3.5/taskHistory/taskHistory.lock rename kotlin/{accumulate/build/kotlin/daemon-is-alive => anagram/.gradle/buildOutputCleanup/built.bin} (100%) create mode 100644 kotlin/anagram/.gradle/buildOutputCleanup/cache.properties create mode 100644 kotlin/anagram/.gradle/buildOutputCleanup/cache.properties.lock create mode 100644 kotlin/anagram/.idea/compiler.xml create mode 100644 kotlin/anagram/.idea/gradle.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__junit_junit_4_12.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml create mode 100644 kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml create mode 100644 kotlin/anagram/.idea/misc.xml create mode 100644 kotlin/anagram/.idea/modules.xml create mode 100644 kotlin/anagram/.idea/modules/anagram_main.iml create mode 100644 kotlin/anagram/.idea/modules/anagram_test.iml create mode 100644 kotlin/anagram/.idea/workspace.xml create mode 100644 kotlin/anagram/README.md create mode 100644 kotlin/anagram/anagram.iml create mode 100644 kotlin/anagram/build.gradle create mode 100644 kotlin/anagram/build/classes/main/Anagram$letterMap$2.class create mode 100644 kotlin/anagram/build/classes/main/Anagram.class create mode 100644 kotlin/anagram/build/classes/test/AnagramTest.class create mode 100644 kotlin/anagram/build/kotlin-build/caches/version.txt create mode 100644 kotlin/anagram/src/main/kotlin/.keep create mode 100644 kotlin/anagram/src/main/kotlin/Anagram.kt create mode 100644 kotlin/anagram/src/test/kotlin/AnagramTest.kt create mode 100644 kotlin/isogram/.gradle/3.5/file-changes/last-build.bin create mode 100644 kotlin/isogram/.gradle/3.5/taskHistory/taskHistory.lock create mode 100644 kotlin/isogram/.gradle/buildOutputCleanup/built.bin create mode 100644 kotlin/isogram/.gradle/buildOutputCleanup/cache.properties create mode 100644 kotlin/isogram/.gradle/buildOutputCleanup/cache.properties.lock create mode 100644 kotlin/isogram/.idea/compiler.xml create mode 100644 kotlin/isogram/.idea/gradle.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__junit_junit_4_12.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml create mode 100644 kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml create mode 100644 kotlin/isogram/.idea/misc.xml create mode 100644 kotlin/isogram/.idea/modules.xml create mode 100644 kotlin/isogram/.idea/modules/isogram_main.iml create mode 100644 kotlin/isogram/.idea/modules/isogram_test.iml create mode 100644 kotlin/isogram/.idea/workspace.xml create mode 100644 kotlin/isogram/README.md create mode 100644 kotlin/isogram/build.gradle create mode 100644 kotlin/isogram/build/classes/main/Isogram.class create mode 100644 kotlin/isogram/build/classes/main/IsogramKt$toFrequencyMap$$inlined$groupingBy$1.class create mode 100644 kotlin/isogram/build/classes/main/IsogramKt.class create mode 100644 kotlin/isogram/build/classes/main/META-INF/isogram_main.kotlin_module create mode 100644 kotlin/isogram/build/classes/test/IsogramTest$Companion.class create mode 100644 kotlin/isogram/build/classes/test/IsogramTest.class create mode 100644 kotlin/isogram/build/kotlin-build/caches/version.txt create mode 100644 kotlin/isogram/isogram.iml create mode 100644 kotlin/isogram/src/main/kotlin/.keep create mode 100644 kotlin/isogram/src/main/kotlin/Isogram.kt create mode 100644 kotlin/isogram/src/test/kotlin/IsogramTest.kt diff --git a/kotlin/anagram/.gradle/3.5/file-changes/last-build.bin b/kotlin/anagram/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/kotlin/anagram/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/anagram/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..8ce84d1b5eec4b3aa6e6a4d1468fe65226747b39 GIT binary patch literal 17 TcmZR+AiJ_(VX=HT0~7!NEItEb literal 0 HcmV?d00001 diff --git a/kotlin/accumulate/build/kotlin/daemon-is-alive b/kotlin/anagram/.gradle/buildOutputCleanup/built.bin similarity index 100% rename from kotlin/accumulate/build/kotlin/daemon-is-alive rename to kotlin/anagram/.gradle/buildOutputCleanup/built.bin diff --git a/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties b/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..5454512 --- /dev/null +++ b/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sun Jun 04 21:03:52 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/anagram/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/anagram/.idea/compiler.xml b/kotlin/anagram/.idea/compiler.xml new file mode 100644 index 0000000..c7faf30 --- /dev/null +++ b/kotlin/anagram/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/gradle.xml b/kotlin/anagram/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/anagram/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/anagram/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/anagram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/anagram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/misc.xml b/kotlin/anagram/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/anagram/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/modules.xml b/kotlin/anagram/.idea/modules.xml new file mode 100644 index 0000000..1573a32 --- /dev/null +++ b/kotlin/anagram/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/modules/anagram_main.iml b/kotlin/anagram/.idea/modules/anagram_main.iml new file mode 100644 index 0000000..325406c --- /dev/null +++ b/kotlin/anagram/.idea/modules/anagram_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/modules/anagram_test.iml b/kotlin/anagram/.idea/modules/anagram_test.iml new file mode 100644 index 0000000..990324f --- /dev/null +++ b/kotlin/anagram/.idea/modules/anagram_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/.idea/workspace.xml b/kotlin/anagram/.idea/workspace.xml new file mode 100644 index 0000000..f79b7a1 --- /dev/null +++ b/kotlin/anagram/.idea/workspace.xml @@ -0,0 +1,899 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Ignore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496624614733 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/README.md b/kotlin/anagram/README.md new file mode 100644 index 0000000..ec01c37 --- /dev/null +++ b/kotlin/anagram/README.md @@ -0,0 +1,15 @@ +# Anagram + +Given a word and a list of possible anagrams, select the correct sublist. + +Given `"listen"` and a list of candidates like `"enlists" "google" +"inlets" "banana"` the program should return a list containing +`"inlets"`. + +## Source + +Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/anagram/anagram.iml b/kotlin/anagram/anagram.iml new file mode 100644 index 0000000..b22a1b6 --- /dev/null +++ b/kotlin/anagram/anagram.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/anagram/build.gradle b/kotlin/anagram/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/anagram/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/anagram/build/classes/main/Anagram$letterMap$2.class b/kotlin/anagram/build/classes/main/Anagram$letterMap$2.class new file mode 100644 index 0000000000000000000000000000000000000000..2161a8a7803f1a5e6ebadf485e4dd4d54a53f33d GIT binary patch literal 2452 zcmb7G-BS}+6#w0Pu&_jpC@P4G6>SJ=0#$1XYH0*b3DFvhRr=v3tYKlZi`g5He$o$T zIzIK)*S_?%ooOldp~Lj0GyRMDg#F!QBSGkNI^^!%bMCq4oZtCc{@VEMcK}0pEU<6X zF-jGq+-I9onw3dop>Ifo5Ln92yVACt#N1*zVL3c=3_FoE%7qyt)qM7#>J+8rI$mPj ze@l*J=Zr-oQI(dRphlmx4X2by&l(k@NNuUQOpTeL`Vv`}`6tl*?}jym1dcYH?_gX* zi$IIzEV}ci!2Vc&lc5`hIkPBfV{e1q@G%uZD|8(Jvn+oj!;|ZFIUzK=YXz4ijI=lq#w!X?a<(oYKpo zsB@{|2#)IL!7+gYwXD5JQ{H@7HJzfV;kZDj4_2CwWTJkz2J{4hTC`(Gw<3`8@odvU zU^_%h6+_0qOixbYl#V{UDsb#Sgf;XN@T}qG=#D@z)_*U80i4zm#~FI$kgb&0j?xh% zkW@#5toN-LYo(~+HELTl?5cU=fxw|yy18aHD>j1jxS-=4UKiN4rNTA5A<$lQ9jWSN z!dzy+nnU5&o$@k;k#-E@66K|vb(hRa+VEJYAzG!USMa8?FiOvvLV;5|so7r95u|Zd z=^fkJA1@l0#lR}?tfHsk8Y3iUEACQmfrc5psR%N7TgP=w2t+p{l&h8tW<|rKO0pxT zRD^05G7;RsO&vMB!&=+Cph}L7tRc^8ie;L^=pQl7=kczN+nA!Jg(@Ll+yUZtgw4AA za7OSR?kdpt1cb$vW*8;gPGHYVeWecAJxoiZcbW$to4E;fUAu+?TW-X1EP0uI8*AK4 z_0#bXu`y^fc%UN;_SW7;c~6?sm@%Y5m4WhNkYiS;2S-w%P$NM<=M^hR)(k5$xxNzB z*H`pF^dwh=tCeJQeWiPMN2nu^4Ah>%q`0pC@qJ66l@l;9GsN;4F&x)fF1uBa4pQxw ziu2pM?&YF@?oWra^Ne^X?anZfd$N{e)^mJYjU<7NtXnkfDWhU3+Gp;{OQSf?dF9h> zd8_0YvRdJV)XQ`9f6RJ;!?&uAw9012S+qQh7DqP+EnUvL)k@JEx0Gl5>%>*FP%Vu; zk|s;pbqHb1DcY{b`NqJ{x--mF#&OtFw&8gu^WEi}nA&ClNzTnMJW4uOjjzUj#npv!%vl($yyeK_x2ABSb~OlQnd#;XpS2GrCvNyN*}Z z5X+re#o4EDxeZ+!=vl+XXSf`|Q;ZDsTnG(^J40)D>q1LcxU+?4zQA|@cmD(#*>&Vr zaVvCx4R@YlI*2pW_lV4FQsZB-b!on@
$bg%{0v=97c&Nae NM%aV&P;LBL{{i^#XL|qu literal 0 HcmV?d00001 diff --git a/kotlin/anagram/build/classes/main/Anagram.class b/kotlin/anagram/build/classes/main/Anagram.class new file mode 100644 index 0000000000000000000000000000000000000000..5f2cc8aadf57f453ae0dd5cb629d570f33107660 GIT binary patch literal 5098 zcmai2iCY}y9e!tb*;$4KmQ4aI8na2zz(TUHnlu8&MkGpDNE%`y#x@z20VY{?ab}hT zTU%SL+RNUx>0NthYub7SFjX-&b39A@ zAgTp^jf5(fgfc=B0_1)`P3I{7>H=q%vP2GJRTb*6n);Q=C8J(~&zjW9zB1{UjQUhe zsa9%I!iE-?9!cG_y4{M|8)SbxYmA9`02fNQ$dT^o%v4;@(7qWp9q-Rr2Cb*3Oc@tR zXh=%Gtu38Ac!c|D_DmO^kd1p{iLRjrZpMO z5>}N|-Dw!=tPoMgB@+BSdPcW)Nbt4@N-bzrun93*uY}Q?O$!&$&obJnqb?|0Swlj7 z!Nj(6ZI0Zhk+&dTg^STqkf`ijMuI^(shUID3CreuLlBo?YZWfVHu@mL?I5-bKV6E; z%R)AY&4V2Y_^XqqD6&i zw}{x?lBXZQ4d=O};5s`JZ&WaXH&bjYo6H{946lPQKmev4L64u)3*LPyt&`gsNZr6@t5(c5=Q)`@IuNqq4O*u9Fx|!(;tV!r1G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M;YlHo{y-86ROEAR69tO$>HP@u-YVgjPnOWl;e}F3+xVAm#AQofJvkB+y7S4U-+)vIYFoP%C zIIkz1wU~1-;=B=YW^Ym>W^92;-Bzjrrlg6mD?u1+LDfrCUiM3D|-4?j=gNE^nB z3C4#p#$1GPE5hiH>* zTnlfb;6}(hiYbiYGRE6jD+%k%WKHpQ2O`!L!)mHOyV_8#J!g$N-6^HY{Ky3cJ<}8<$Sah~&poY>zOQAdGB5I8B5zL^y+CoNYr`PY~XUvvev# z2%;>-NeWH;J0?kYO_E+ul5+P^Nf~WP$}nR3g~T9K;Lgtwl3t1S@`)6;R)7qv!WIg_~I7$%Y>i93C!aq zTxo-UH-Ue+h5ayskCEOp>>n7U51X*r4<03{X<<#O&ud|eq`J=5@B&-djfbfC0wR@& zy1Z%2rZIPoeu|%N_U+z=v*oI01DCOf{*}Ke{0V>K?^0o5`nvt_`^&x>{ZGaoEetiS zOZM2%#8BI^mZ3eGw9@m)A_ygZv8t+ENy2g2p>l%(mMdL+{H#Gkpj!BI_{vRAq=@kF~ literal 0 HcmV?d00001 diff --git a/kotlin/anagram/build/kotlin-build/caches/version.txt b/kotlin/anagram/build/kotlin-build/caches/version.txt new file mode 100644 index 0000000..01aabac --- /dev/null +++ b/kotlin/anagram/build/kotlin-build/caches/version.txt @@ -0,0 +1 @@ +11001 \ No newline at end of file diff --git a/kotlin/anagram/src/main/kotlin/.keep b/kotlin/anagram/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/anagram/src/main/kotlin/Anagram.kt b/kotlin/anagram/src/main/kotlin/Anagram.kt new file mode 100644 index 0000000..d9f7a97 --- /dev/null +++ b/kotlin/anagram/src/main/kotlin/Anagram.kt @@ -0,0 +1,28 @@ +class Anagram(val internalString: String) { + val letterMap: Map by lazy { + val temp = emptyMap().toMutableMap(); + for (i in internalString){ + if (temp.containsKey(i)){ + temp.put(i.toLowerCase(), temp[i]!!.inc()) + } + else temp.put(i.toLowerCase(), 1) + } + temp + } + + fun match(wordList: List): List{ + return wordList.filter { isAnagram(it) } + } + + private fun isAnagram(candidate: String): Boolean{ + if (internalString.toLowerCase() == candidate.toLowerCase()) return false + val candidateLetterMap = emptyMap().toMutableMap() + for (i in candidate){ + if (candidateLetterMap.containsKey(i)){ + candidateLetterMap.put(i.toLowerCase(), candidateLetterMap[i]!!.inc()) + } + else candidateLetterMap.put(i.toLowerCase(), 1) + } + return candidateLetterMap == letterMap + } +} \ No newline at end of file diff --git a/kotlin/anagram/src/test/kotlin/AnagramTest.kt b/kotlin/anagram/src/test/kotlin/AnagramTest.kt new file mode 100644 index 0000000..8a76f00 --- /dev/null +++ b/kotlin/anagram/src/test/kotlin/AnagramTest.kt @@ -0,0 +1,84 @@ +import org.junit.Test +import org.junit.Ignore +import kotlin.test.assertEquals + +class AnagramTest { + + + @Test + fun noMatches() { + val detector = Anagram("diaper") + assertEquals(listOf(), detector.match(listOf("hello", "world", "zombies", "pants"))) + } + + + @Test + fun simpleAnagram() { + val detector = Anagram("ant") + val anagram = detector.match(listOf("tan", "stand", "at")) + assertEquals(listOf("tan"), anagram) + } + + + @Test + fun detectMultipleAnagrams() { + val detector = Anagram("master") + val anagrams = detector.match(listOf("stream", "pigeon", "maters")) + assertEquals(listOf("maters", "stream"), anagrams.sorted()) + } + + + @Test + fun doesNotConfuseDifferentDuplicates() { + val detector = Anagram("galea") + val anagrams = detector.match(listOf("eagle")) + assertEquals(listOf(), anagrams) + } + + + @Test + fun identicalWordIsNotAnagram() { + val detector = Anagram("corn") + val anagrams = detector.match(listOf("corn", "dark", "Corn", "rank", "CORN", "cron", "park")) + assertEquals(listOf("cron"), anagrams) + } + + + @Test + fun eliminateAnagramsWithSameChecksum() { + val detector = Anagram("mass") + assertEquals(listOf(), detector.match(listOf("last"))) + } + + + @Test + fun eliminateAnagramSubsets() { + val detector = Anagram("good") + assertEquals(listOf(), detector.match(listOf("dog", "goody"))) + } + + + @Test + fun detectAnagrams() { + val detector = Anagram("listen") + val anagrams = detector.match(listOf("enlists", "google", "inlets", "banana")) + assertEquals(listOf("inlets"), anagrams) + } + + + @Test + fun multipleAnagrams() { + val detector = Anagram("allergy") + val anagrams = detector.match(listOf("gallery", "ballerina", "regally", "clergy", "largely", "leading")) + assertEquals(listOf("gallery", "largely", "regally"), anagrams.sorted()) + } + + + @Test + fun anagramsAreCaseInsensitive() { + val detector = Anagram("Orchestra") + val anagrams = detector.match(listOf("cashregister", "Carthorse", "radishes")) + assertEquals(listOf("Carthorse"), anagrams) + } + +} diff --git a/kotlin/isogram/.gradle/3.5/file-changes/last-build.bin b/kotlin/isogram/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/kotlin/isogram/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/isogram/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..d638edb2dbe174460dff8bb361e521c7d4942cc3 GIT binary patch literal 17 TcmZSH=xU_*_2um+3{U_7I)ViE literal 0 HcmV?d00001 diff --git a/kotlin/isogram/.gradle/buildOutputCleanup/built.bin b/kotlin/isogram/.gradle/buildOutputCleanup/built.bin new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties b/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..0ab6d2f --- /dev/null +++ b/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sun Jun 04 21:56:37 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/isogram/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/isogram/.idea/compiler.xml b/kotlin/isogram/.idea/compiler.xml new file mode 100644 index 0000000..2384a48 --- /dev/null +++ b/kotlin/isogram/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/gradle.xml b/kotlin/isogram/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/isogram/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/isogram/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/isogram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/isogram/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/misc.xml b/kotlin/isogram/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/isogram/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/modules.xml b/kotlin/isogram/.idea/modules.xml new file mode 100644 index 0000000..3123a70 --- /dev/null +++ b/kotlin/isogram/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/modules/isogram_main.iml b/kotlin/isogram/.idea/modules/isogram_main.iml new file mode 100644 index 0000000..9be7fcf --- /dev/null +++ b/kotlin/isogram/.idea/modules/isogram_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/modules/isogram_test.iml b/kotlin/isogram/.idea/modules/isogram_test.iml new file mode 100644 index 0000000..ec8ab1d --- /dev/null +++ b/kotlin/isogram/.idea/modules/isogram_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/.idea/workspace.xml b/kotlin/isogram/.idea/workspace.xml new file mode 100644 index 0000000..35c25ea --- /dev/null +++ b/kotlin/isogram/.idea/workspace.xml @@ -0,0 +1,878 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496627789651 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/README.md b/kotlin/isogram/README.md new file mode 100644 index 0000000..c21c931 --- /dev/null +++ b/kotlin/isogram/README.md @@ -0,0 +1,21 @@ +# Isogram + +Determine if a word or phrase is an isogram. + +An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter. + +Examples of isograms: + +- lumberjacks +- background +- downstream + +The word *isograms*, however, is not an isogram, because the s repeats. + +## Source + +Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/isogram/build.gradle b/kotlin/isogram/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/isogram/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/isogram/build/classes/main/Isogram.class b/kotlin/isogram/build/classes/main/Isogram.class new file mode 100644 index 0000000000000000000000000000000000000000..a3368e5182f5dbb992a7ddb0bb2908546f678687 GIT binary patch literal 2770 zcmZ`*-*XdH6#nie-A%V?DcC}Tg4IUsFG!POizy-)S`AGDS||c)-KI;sZL+D^O$C3} zANb&Zz?wBnm@{x?2Rzq`9>wj<1B_MUt0Ip00!yXT&pzaRbfJAe$n z5zz8Zb*W}lGzfvt6=U5Ityqg*$=Kyq=sjI53mVEM!>r(n9YWK8`z8RRQCCD&f%8u#$r;yB~)@)`lw>dfav z_)z~}D1jy*eRpzaF)4YUVh-yvCP$#BL4$YdxoWx0d%`*=6>lIftJ}D0b*2DeXxsX(ZFh>sHxg zM&zk8%VvcYm9*CR6WEiinI+R&H)}hZ-Dt$wyJ$MDWqWtFVI{Gz2gnzz0`V}8KwD_p zpBc$a(yrP(JG~hK>F{?8b1TplQZ`7EJ;DR^LE_hU-Oi}HZ1DtI3&Aa>br?Cgue%8L zbs8)kQF--Z`Qq%wGsWCw9AzxELP3SflO?tx@2c)C1U+fSbd5#BHMoaTS&y(?3i(kv zUGSz55UZRmrUhQ#+UU`h9z|C=w>ESoCWSU#ik%%CVt;+3^lWWplo9co7E>O6uPU9& zxsJ}rL1iSGQ9D~Wst%^hc}^;*fC zvLtGkKRIhI)R!i2xF&ma)fPwuP;)*|$RBCO9hJ->A=#!BVcTqhO8sYmGRb)dwSNxn zYrT&>L-)}=Gh95HjXuDEEBEm977k@w649)hP&e_Mz$RW4$Z82~6GsJZBPS)&zlG6k zED_7LCR#T!C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6TMWCUP%Wp7P4i9EtA5Mr+$~TG+1(xW&>%4rfZ2d{_#E| zaJ#*j4Kj4(M|YkOcRlB|iZQ5rSo6HBhcSXNm9>1p3bbk##0E)qaS#ejw7aX16Apm$ z9C2DQ{w%hbh~~JNJthWU+A7d@5P9vmCAuE9C=eH*UIfM$y#W zip|%Vjzs7@Nxh+|=4y?wZg{4z)rEWVpi*3W?n=|)Jf_DrGhebC4o1$SL#rSV&X^{P zR?;0ulDtDZ71K4!a@TMS#<*gdmaErhITFm2pN-A=ABlKv!13jyJdT@OA5mJShQeKq zPXB~k(VsE-10@BYavi9@UmHXPEA*JAju*UEvqTHg=_=-5;r=URJdfva zLAZg&w_W&*Zwj`t%l+Hj*2*KbjYH~Y?RQm;=Ej?+b#;0?G2X7zaW=I7^0hUPmf+{f z@do3`Qnf{XHJViu6Nx*C#KPQSg2&_{kMnAj9rJ|2`LKzH_?#z|V7yubL->O04&_Ts zbMGFyGPqp(i{MIA>f;5jddsyv2nYQb*n{fex`ROnLk@-=j5ru|Fy`P!?dF|-0HJ+0 AvH$=8 literal 0 HcmV?d00001 diff --git a/kotlin/isogram/build/classes/main/IsogramKt.class b/kotlin/isogram/build/classes/main/IsogramKt.class new file mode 100644 index 0000000000000000000000000000000000000000..f96d875d4fb7863cb8f4707ce8e1eb99e141f9a8 GIT binary patch literal 1482 zcmaJ>-*eMO5dKb1?BsAwYSKWG0;UlqacE?@k zCl9>w=kVCKGBCqrc;t^_x{~Es0VX5eop$frz1?s3^zqZ%_Wda>4>Q!)51CI>%21#VrZZ3{!6mx3Yl^GH84y)ZHSA_=e*GN(?ijR5lJp&>kcz z3z%Y9Ii<%u%YkVskHVA(W;gJo=S0Axm!@4nnIXTXJf$Bp%x8nix^65{0Mq!6;}T{F zm!|Cau1l0B{QQ=BE#L~n)pG!G;pT`%DV)O%Kk_sMz1TX(;EO^P@jb3`%;OqE@w6DG z>N8x)aCasFhKr^$|IQ@Oz?ux@j6vEL4BrmJ*_K)y2ra1UMz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S8&j zI`qSrXjy`rkVia(R0vTmo?n?= zQ~r79m1Xz4K#Aw04QfFdiKe6fQfp&dA0w!kiDq?S;ycgPS<|FDZQb0$mZG=~tNAU^ ze6fnG#PlRS1@)y?va^+Cp~Q1adLTVIHa?YB#wG_cQ)3rAobd3XhnGB@tmAmfLvP)9 z#^c9499QD=t+Tt$M2UYu036T82hxs1b)4|)d=bn4cbIxB-aX}Jw^VRhZEQJN4KuC%>|xgNNVZ+e02+MancaBn&O+LS=|rqv8= zfunnrq9iscM?kV!*B zuRv}G-Gz3$X zQy+OJXVjS6#VYw<7D!Gzd{E~VYcY(`#pU8s3L^rCqg<_TwoJ$6OLDEIS#}i#(y2)u z?+YBPt=YAW?YCBz5k7$vam#N_k;=!1_{hKq_&9@cqz!c8QwBF(BTXU1^lZCz-*QP4 z-NiFCwtc{CU@qDoWmbSL{dZf0-=R}ECLC@@ioL)(5h7dzE7%WCtzpys!|YnHcR zdsFHOjAKdNz9mrF-R|CwUdL^LBmbeVV@1H&37L&97Q~qimiGu7s_(Syvb*U>XSHe1 z?9>|*G~2E-LHSC%W;K^A&#|bns0M-lisRbzL2K3aBFRu>Yw2GsjqUccjp_}D>8jIk zEkE$+;KUy4r&nSH8 + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/isogram/src/main/kotlin/.keep b/kotlin/isogram/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/isogram/src/main/kotlin/Isogram.kt b/kotlin/isogram/src/main/kotlin/Isogram.kt new file mode 100644 index 0000000..02bab4d --- /dev/null +++ b/kotlin/isogram/src/main/kotlin/Isogram.kt @@ -0,0 +1,9 @@ +fun String.toFrequencyMap(): Map = this.groupingBy{it.toLowerCase()}.eachCount() + +object Isogram { + fun isIsogram(inpString: String): Boolean{ + val frequencyMap: Map = inpString.toFrequencyMap() + frequencyMap.filter { it.key.isLetter() } + return frequencyMap.values.none { it > 1 } + } +} \ No newline at end of file diff --git a/kotlin/isogram/src/test/kotlin/IsogramTest.kt b/kotlin/isogram/src/test/kotlin/IsogramTest.kt new file mode 100644 index 0000000..5eaf71b --- /dev/null +++ b/kotlin/isogram/src/test/kotlin/IsogramTest.kt @@ -0,0 +1,33 @@ + +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.Parameterized +import kotlin.test.assertEquals + +@RunWith(Parameterized::class) +class IsogramTest(val input: String, val expectedOutput: Boolean) { + + companion object { + @JvmStatic + @Parameterized.Parameters(name = "{index}: isogram({0})={1}") + fun data() = listOf( + arrayOf("duplicates", true), + arrayOf("eleven", false), + arrayOf("subdermatoglyphic", true), + arrayOf("Alphabet", false), + arrayOf("thumbscrew-japingly", true), + arrayOf("Hjelmqvist-Gryb-Zock-Pfund-Wax", true), + arrayOf("Heizölrückstoßabdämpfung", true), + arrayOf("the quick brown fox", false), + arrayOf("Emily Jung Schwartzkopf", true), + arrayOf("éléphant", false) + ) + } + + + @Test + fun test() { + assertEquals(expectedOutput, Isogram.isIsogram(input)) + } +} diff --git a/kotlin/pangram/.idea/workspace.xml b/kotlin/pangram/.idea/workspace.xml index 54839ac..0eaba50 100644 --- a/kotlin/pangram/.idea/workspace.xml +++ b/kotlin/pangram/.idea/workspace.xml @@ -18,12 +18,12 @@ - + - - + + @@ -420,9 +420,6 @@ - - - @@ -481,11 +478,14 @@ + + + - + @@ -815,36 +816,36 @@ - - + - - - - - - - - - + + + + + + + - + - + - + - + + - + + @@ -859,6 +860,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -880,8 +908,8 @@ - - + +