-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
22 changes: 22 additions & 0 deletions
22
src/main/java/io/github/spannm/leetcode/lc0/lc0600/Problem0626.java
This file contains 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,22 @@ | ||
package io.github.spannm.leetcode.lc0.lc0600; | ||
|
||
import io.github.spannm.leetcode.LeetcodeSqlProblem; | ||
|
||
/** | ||
* 626. Exchange Seats. | ||
*/ | ||
public class Problem0626 extends LeetcodeSqlProblem { | ||
|
||
Problem0626() { | ||
super(""" | ||
SELECT | ||
s1.id, | ||
COALESCE(s2.student, s1.student) AS student | ||
FROM | ||
Seat AS s1 | ||
LEFT JOIN | ||
Seat AS s2 ON (s1.id + 1) ^ 1 - 1 = s2.id | ||
ORDER BY 1"""); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/github/spannm/leetcode/lc0/lc0600/Problem0627.java
This file contains 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,23 @@ | ||
package io.github.spannm.leetcode.lc0.lc0600; | ||
|
||
import io.github.spannm.leetcode.LeetcodeSqlProblem; | ||
|
||
/** | ||
* 627. Swap Salary. | ||
*/ | ||
public class Problem0627 extends LeetcodeSqlProblem { | ||
|
||
Problem0627() { | ||
super(""" | ||
UPDATE | ||
salary | ||
SET | ||
sex = | ||
CASE sex | ||
WHEN 'm' | ||
THEN 'f' | ||
ELSE 'm' | ||
END"""); | ||
} | ||
|
||
} |
This file contains 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 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
20 changes: 20 additions & 0 deletions
20
src/test/java/io/github/spannm/leetcode/lc0/lc0600/Problem0628Test.java
This file contains 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,20 @@ | ||
package io.github.spannm.leetcode.lc0.lc0600; | ||
|
||
import io.github.spannm.leetcode.LeetcodeBaseTest; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.converter.ConvertWith; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
class Problem0628Test extends LeetcodeBaseTest { | ||
|
||
@ParameterizedTest(name = "[{index}] {0} --> {1}") | ||
@CsvSource(delimiter = ';', value = { | ||
"1,2,3; 6", | ||
"1,2,3,4; 24", | ||
"-1,-2,-3; -6" | ||
}) | ||
void test(@ConvertWith(CsvToIntArray.class) int[] _nums, int _expectedResult) { | ||
assertEquals(_expectedResult, new Problem0628().maximumProduct(_nums)); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/test/java/io/github/spannm/leetcode/lc1/lc1700/Problem1750Test.java
This file contains 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,19 @@ | ||
package io.github.spannm.leetcode.lc1.lc1700; | ||
|
||
import io.github.spannm.leetcode.LeetcodeBaseTest; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
class Problem1750Test extends LeetcodeBaseTest { | ||
|
||
@ParameterizedTest(name = "[{index}] {0} --> {1}") | ||
@CsvSource(delimiter = ';', value = { | ||
"ca; 2", | ||
"cabaabac; 0", | ||
"aabccabba; 3" | ||
}) | ||
void test(String _s, int _expectedResult) { | ||
assertEquals(_expectedResult, new Problem1750().minimumLength(_s)); | ||
} | ||
|
||
} |