public class Utils
extends java.lang.Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isPalindrome(java.lang.String s)
Time complexity: O(n)
Space complexity: O(n) total and O(1) auxiliary
|
static int |
max(int[] arr)
Time complexity: O(n)
Space complexity: O(n) total and O(1) auxiliary
|
static int |
min(int[] arr)
Time complexity: O(n)
Space complexity: O(n) total and O(1) auxiliary
|
static void |
reverse(int[] arr,
int start,
int end)
Time complexity: O(n)
Space complexity: O(n) total and O(1) auxiliary
|
static void |
swap(int[] arr,
int i,
int j)
Time complexity: O(1)
Space complexity: O(n) total and O(1) auxiliary
|
public static void swap(int[] arr,
int i,
int j)
public static void reverse(int[] arr,
int start,
int end)
public static int max(int[] arr)
throws java.lang.Exception
java.lang.Exceptionpublic static int min(int[] arr)
throws java.lang.Exception
java.lang.Exceptionpublic static boolean isPalindrome(java.lang.String s)