Skip to content

style: use proper spelling #5436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pmd-exclude.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ com.thealgorithms.datastructures.crdt.LWWElementSet=UselessParentheses
com.thealgorithms.datastructures.crdt.Pair=UnusedPrivateField
com.thealgorithms.datastructures.graphs.AStar=UselessParentheses
com.thealgorithms.datastructures.graphs.AdjacencyMatrixGraph=CollapsibleIfStatements,UnnecessaryFullyQualifiedName,UselessParentheses
com.thealgorithms.datastructures.graphs.BipartiteGrapfDFS=CollapsibleIfStatements
com.thealgorithms.datastructures.graphs.BipartiteGraphDFS=CollapsibleIfStatements
com.thealgorithms.datastructures.graphs.Kruskal=UselessParentheses
com.thealgorithms.datastructures.hashmap.hashing.HashMapCuckooHashing=UselessParentheses
com.thealgorithms.datastructures.heaps.FibonacciHeap=UselessParentheses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*
* Output : YES
*/
public final class BipartiteGrapfDFS {
private BipartiteGrapfDFS() {
public final class BipartiteGraphDFS {
private BipartiteGraphDFS() {
}

private static boolean bipartite(int v, ArrayList<ArrayList<Integer>> adj, int[] color, int node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* @author Arun Pandey (https://github.com/pandeyarun709)
*/
public class MergeKSortedLinkedlist {
public class MergeKSortedLinkedList {

/**
* This function merge K sorted LinkedList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public final class LargestRectangle {
private LargestRectangle() {
}

public static String largestRectanglehistogram(int[] heights) {
public static String largestRectangleHistogram(int[] heights) {
int n = heights.length;
int maxArea = 0;
Stack<int[]> st = new Stack<>();
Expand All @@ -32,7 +32,7 @@ public static String largestRectanglehistogram(int[] heights) {
}

public static void main(String[] args) {
assert largestRectanglehistogram(new int[] {2, 1, 5, 6, 2, 3}).equals("10");
assert largestRectanglehistogram(new int[] {2, 4}).equals("4");
assert largestRectangleHistogram(new int[] {2, 1, 5, 6, 2, 3}).equals("10");
assert largestRectangleHistogram(new int[] {2, 4}).equals("4");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ private ReverseWordsInString() {
* @param s the input string
* @return A string created by reversing the order of the words in {@code s}
*/

public static String reverseWordsInString(final String s) {
var words = s.trim().split("\\s+");
Collections.reverse(Arrays.asList(words));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/thealgorithms/strings/Upper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public static void main(String[] args) {
}

/**
* Converts all of the characters in this {@code String} to upper case
* Converts all the characters in this {@code String} to upper case
*
* @param s the string to convert
* @return the {@code String}, converted to uppercase.
*/
public static String toUpperCase(String s) {
if (s == null || "".equals(s)) {
if (s == null || s.isEmpty()) {
return s;
}
char[] values = s.toCharArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ void testLargestRectangleHistogramWithTypicalCases() {
// Typical case with mixed heights
int[] heights = {2, 1, 5, 6, 2, 3};
String expected = "10";
String result = LargestRectangle.largestRectanglehistogram(heights);
String result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);

// Another typical case with increasing heights
heights = new int[] {2, 4};
expected = "4";
result = LargestRectangle.largestRectanglehistogram(heights);
result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);

// Case with multiple bars of the same height
heights = new int[] {4, 4, 4, 4};
expected = "16";
result = LargestRectangle.largestRectanglehistogram(heights);
result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);
}

Expand All @@ -32,19 +32,19 @@ void testLargestRectangleHistogramWithEdgeCases() {
// Edge case with an empty array
int[] heights = {};
String expected = "0";
String result = LargestRectangle.largestRectanglehistogram(heights);
String result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);

// Edge case with a single bar
heights = new int[] {5};
expected = "5";
result = LargestRectangle.largestRectanglehistogram(heights);
result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);

// Edge case with all bars of height 0
heights = new int[] {0, 0, 0};
expected = "0";
result = LargestRectangle.largestRectanglehistogram(heights);
result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);
}

Expand All @@ -56,7 +56,7 @@ void testLargestRectangleHistogramWithLargeInput() {
heights[i] = 1;
}
String expected = "10000";
String result = LargestRectangle.largestRectanglehistogram(heights);
String result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);
}

Expand All @@ -65,13 +65,13 @@ void testLargestRectangleHistogramWithComplexCases() {
// Complex case with a mix of heights
int[] heights = {6, 2, 5, 4, 5, 1, 6};
String expected = "12";
String result = LargestRectangle.largestRectanglehistogram(heights);
String result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);

// Case with a peak in the middle
heights = new int[] {2, 1, 5, 6, 2, 3, 1};
expected = "10";
result = LargestRectangle.largestRectanglehistogram(heights);
result = LargestRectangle.largestRectangleHistogram(heights);
assertEquals(expected, result);
}
}