chore: fix some comments (#5333)

This commit is contained in:
mountdisk
2024-08-17 01:19:15 +08:00
committed by GitHub
parent 98bee26d51
commit 7c58b190c8
5 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ public final class ParenthesesGenerator {
*/
public static List<String> generateParentheses(final int n) {
if (n < 0) {
throw new IllegalArgumentException("The number of pairs of parentheses cannot be nagative");
throw new IllegalArgumentException("The number of pairs of parentheses cannot be negative");
}
List<String> result = new ArrayList<>();
generateParenthesesHelper(result, "", 0, 0, n);

View File

@ -95,7 +95,7 @@ public class BSTRecursive {
}
/**
* Serach recursively if the given value is present in BST or not.
* Search recursively if the given value is present in BST or not.
*
* @param node the current node to check
* @param data the value to be checked

View File

@ -6,7 +6,7 @@ public final class PalindromePrime {
private PalindromePrime() {
}
public static void main(String[] args) { // Main funtion
public static void main(String[] args) { // Main function
Scanner in = new Scanner(System.in);
System.out.println("Enter the quantity of First Palindromic Primes you want");
int n = in.nextInt(); // Input of how many first palindromic prime we want

View File

@ -17,7 +17,7 @@ import java.util.Scanner;
from its initial sorted position.
Eg. For [2,5,6,8,11,12,15,18], 1 rotation gives [5,6,8,11,12,15,18,2], 2 rotations
[6,8,11,12,15,18,2,5] and so on. Finding the minimum element will take O(N) time but, we can use
Binary Search to find the mimimum element, we can reduce the complexity to O(log N). If we look
Binary Search to find the minimum element, we can reduce the complexity to O(log N). If we look
at the rotated array, to identify the minimum element (say a[i]), we observe that
a[i-1]>a[i]<a[i+1].