mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-24 04:54:21 +08:00
Add automatic linter (#4214)
This commit is contained in:
@ -92,13 +92,11 @@ public class ColorContrastRatio {
|
||||
|
||||
final Color foreground = new Color(23, 103, 154);
|
||||
final double foregroundLuminance = algImpl.getRelativeLuminance(foreground);
|
||||
assert foregroundLuminance
|
||||
== 0.12215748057375966 : "Test 4 Failed - Incorrect relative luminance.";
|
||||
assert foregroundLuminance == 0.12215748057375966 : "Test 4 Failed - Incorrect relative luminance.";
|
||||
|
||||
final Color background = new Color(226, 229, 248);
|
||||
final double backgroundLuminance = algImpl.getRelativeLuminance(background);
|
||||
assert backgroundLuminance
|
||||
== 0.7898468477881603 : "Test 5 Failed - Incorrect relative luminance.";
|
||||
assert backgroundLuminance == 0.7898468477881603 : "Test 5 Failed - Incorrect relative luminance.";
|
||||
|
||||
final double contrastRatio = algImpl.getContrastRatio(foreground, background);
|
||||
assert contrastRatio == 4.878363954846178 : "Test 6 Failed - Incorrect contrast ratio.";
|
||||
|
@ -22,8 +22,7 @@ public class RangeInSortedArray {
|
||||
|
||||
// Recursive altered binary search which searches for leftmost as well as rightmost occurrence
|
||||
// of 'key'
|
||||
public static void alteredBinSearch(
|
||||
int[] nums, int key, int left, int right, int[] range, boolean goLeft) {
|
||||
public static void alteredBinSearch(int[] nums, int key, int left, int right, int[] range, boolean goLeft) {
|
||||
if (left > right) {
|
||||
return;
|
||||
}
|
||||
@ -51,8 +50,7 @@ public class RangeInSortedArray {
|
||||
|
||||
// Iterative altered binary search which searches for leftmost as well as rightmost occurrence
|
||||
// of 'key'
|
||||
public static void alteredBinSearchIter(
|
||||
int[] nums, int key, int left, int right, int[] range, boolean goLeft) {
|
||||
public static void alteredBinSearchIter(int[] nums, int key, int left, int right, int[] range, boolean goLeft) {
|
||||
while (left <= right) {
|
||||
int mid = (left + right) / 2;
|
||||
if (nums[mid] > key) {
|
||||
|
@ -26,8 +26,7 @@ public class WordBoggle {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Testcase
|
||||
List<String> ans = new ArrayList<>(
|
||||
Arrays.asList("a", "boggle", "this", "NOTRE_PEATED", "is", "simple", "board"));
|
||||
List<String> ans = new ArrayList<>(Arrays.asList("a", "boggle", "this", "NOTRE_PEATED", "is", "simple", "board"));
|
||||
assert (boggleBoard(
|
||||
new char[][] {
|
||||
{'t', 'h', 'i', 's', 'i', 's', 'a'},
|
||||
@ -55,8 +54,7 @@ public class WordBoggle {
|
||||
.equals(ans));
|
||||
}
|
||||
|
||||
public static void explore(int i, int j, char[][] board, TrieNode trieNode, boolean[][] visited,
|
||||
Set<String> finalWords) {
|
||||
public static void explore(int i, int j, char[][] board, TrieNode trieNode, boolean[][] visited, Set<String> finalWords) {
|
||||
if (visited[i][j]) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user