Skip to content

Commit c057a6f

Browse files
committed
remove-vowels-from-a-string
1 parent 8657508 commit c057a6f

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Step 2. Add the dependency
4949

5050
<summary>展开查看</summary>
5151

52+
https://leetcode.cn/problems/remove-vowels-from-a-string/
53+
5254
https://leetcode.cn/problems/sort-the-students-by-their-kth-score
5355

5456
https://leetcode.cn/problems/complement-of-base-10-integer

leetcode-test.iml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module version="4">
3+
<component name="AdditionalModuleElements">
4+
<content url="file://$MODULE_DIR$" dumb="true">
5+
<sourceFolder url="file://$MODULE_DIR$/remove-vowels-from-a-string" isTestSource="false" />
6+
</content>
7+
</component>
38
<component name="AutoImportedSourceRoots">
49
<option name="directories">
510
<list>
@@ -17,6 +22,7 @@
1722
<option value="number-of-distinct-averages" />
1823
<option value="operations-lcci" />
1924
<option value="possible-bipartition" />
25+
<option value="remove-vowels-from-a-string" />
2026
<option value="reveal-cards-in-increasing-order" />
2127
<option value="serialize-and-deserialize-binary-tree" />
2228
<option value="split-message-based-on-limit" />

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<source>three-in-one-lcci</source>
107107
<source>count-ways-to-build-good-string</source>
108108
<sourceDir>split-message-based-on-limit</sourceDir>
109+
<source>remove-vowels-from-a-string</source>
109110
</sourceDirs>
110111
</configuration>
111112
</execution>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.github.masx200.leetcode_test.remove_vowels_from_a_string
2+
3+
class Solution {
4+
5+
fun removeVowels(s: String): String {
6+
7+
val set = hashSetOf<Char>('a', 'i', 'o', 'u', 'e')
8+
9+
10+
return s.map { if (set.contains(it)) "" else it }.joinToString("")
11+
}
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.masx200.leetcode_test.remove_vowels_from_a_string
2+
3+
import org.junit.jupiter.api.Assertions.assertEquals
4+
import org.junit.jupiter.api.Test
5+
6+
class SolutionTest {
7+
8+
@Test
9+
fun removeVowels() {
10+
assertEquals("ltcdscmmntyfrcdrs", Solution().removeVowels("leetcodeisacommunityforcoders"))
11+
assertEquals("", Solution().removeVowels("aeiou"))
12+
}
13+
}

test/com/github/masx200/split_message_based_on_limit/SolutionTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.github.masx200.leetcode_test.split_message_based_on_limit
22

3-
import kotlin.test.assertContentEquals
43
import org.junit.jupiter.api.Test
4+
import kotlin.test.assertContentEquals
55

66
internal class SolutionTest {
77

0 commit comments

Comments
 (0)