Skip to content

Commit 7a64938

Browse files
authored
Improved mysql tasks
1 parent fe66e08 commit 7a64938

File tree

50 files changed

+169
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+169
-168
lines changed

src/main/kotlin/g0201_0300/s0212_word_search_ii/Solution.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ package g0201_0300.s0212_word_search_ii
66
@Suppress("NAME_SHADOWING")
77
class Solution {
88
private var root: Tree? = null
9-
fun findWords(board: Array<CharArray>, words: Array<String?>): List<String> {
10-
if (board.size < 1 || board[0].size < 1) {
9+
10+
fun findWords(board: Array<CharArray>, words: Array<String>): List<String> {
11+
if (board.isEmpty() || board[0].isEmpty()) {
1112
return emptyList()
1213
}
1314
root = Tree()
1415
for (word in words) {
15-
Tree.addWord(root, word!!)
16+
Tree.addWord(root, word)
1617
}
1718
val collected: MutableList<String> = ArrayList()
1819
for (i in board.indices) {

src/test/kotlin/g0101_0200/s0175_combine_two_tables/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class MysqlTest {
3434
@Test
3535
@Throws(SQLException::class, FileNotFoundException::class)
3636
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
37-
dataSource.getConnection().use { connection ->
37+
dataSource.connection.use { connection ->
3838
connection.createStatement().use { statement ->
3939
statement.executeQuery(
4040
BufferedReader(

src/test/kotlin/g0201_0300/s0212_word_search_ii/SolutionTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class SolutionTest {
1313
charArrayOf('i', 'h', 'k', 'r'),
1414
charArrayOf('i', 'f', 'l', 'v'),
1515
)
16-
val words = arrayOf<String?>("oath", "pea", "eat", "rain")
16+
val words = arrayOf<String>("oath", "pea", "eat", "rain")
1717
val expected: MutableList<String> = ArrayList()
1818
expected.add("oath")
1919
expected.add("eat")
@@ -23,7 +23,7 @@ internal class SolutionTest {
2323
@Test
2424
fun findWords2() {
2525
val board = arrayOf(charArrayOf('a', 'b'), charArrayOf('c', 'd'))
26-
val words = arrayOf<String?>("abcb")
26+
val words = arrayOf<String>("abcb")
2727
assertThat(Solution().findWords(board, words), equalTo(emptyList()))
2828
}
2929
}

src/test/kotlin/g0201_0300/s0262_trips_and_users/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal class MysqlTest {
5353
@Test
5454
@Throws(SQLException::class, FileNotFoundException::class)
5555
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
56-
dataSource.getConnection().use { connection ->
56+
dataSource.connection.use { connection ->
5757
connection.createStatement().use { statement ->
5858
statement.executeQuery(
5959
BufferedReader(

src/test/kotlin/g0501_0600/s0511_game_play_analysis_i/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class MysqlTest {
3434
@Test
3535
@Throws(SQLException::class, FileNotFoundException::class)
3636
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
37-
dataSource.getConnection().use { connection ->
37+
dataSource.connection.use { connection ->
3838
connection.createStatement().use { statement ->
3939
statement.executeQuery(
4040
BufferedReader(

src/test/kotlin/g0501_0600/s0550_game_play_analysis_iv/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal class MysqlTest {
3939
@Test
4040
@Throws(SQLException::class, FileNotFoundException::class)
4141
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
42-
dataSource.getConnection().use { connection ->
42+
dataSource.connection.use { connection ->
4343
connection.createStatement().use { statement ->
4444
statement.executeQuery(
4545
BufferedReader(

src/test/kotlin/g0501_0600/s0584_find_customer_referee/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal class MysqlTest {
2929
@Test
3030
@Throws(SQLException::class, FileNotFoundException::class)
3131
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
32-
dataSource.getConnection().use { connection ->
32+
dataSource.connection.use { connection ->
3333
connection.createStatement().use { statement ->
3434
statement.executeQuery(
3535
BufferedReader(

src/test/kotlin/g0601_0700/s0602_friend_requests_ii_who_has_the_most_friends/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal class MysqlTest {
3131
@Test
3232
@Throws(SQLException::class, FileNotFoundException::class)
3333
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
34-
dataSource.getConnection().use { connection ->
34+
dataSource.connection.use { connection ->
3535
connection.createStatement().use { statement ->
3636
statement.executeQuery(
3737
BufferedReader(

src/test/kotlin/g0601_0700/s0607_sales_person/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal class MysqlTest {
4949
@Test
5050
@Throws(SQLException::class, FileNotFoundException::class)
5151
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
52-
dataSource.getConnection().use { connection ->
52+
dataSource.connection.use { connection ->
5353
connection.createStatement().use { statement ->
5454
statement.executeQuery(
5555
BufferedReader(

src/test/kotlin/g0601_0700/s0610_triangle_judgement/MysqlTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal class MysqlTest {
2727
@Test
2828
@Throws(SQLException::class, FileNotFoundException::class)
2929
fun testScript(@EmbeddedDatabase dataSource: DataSource) {
30-
dataSource.getConnection().use { connection ->
30+
dataSource.connection.use { connection ->
3131
connection.createStatement().use { statement ->
3232
statement.executeQuery(
3333
BufferedReader(

0 commit comments

Comments
 (0)