Created
April 27, 2020 11:39
-
-
Save ereshzealous/02518124966aeb45d7ab6c86cd99837e to your computer and use it in GitHub Desktop.
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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Scanner; | |
public class HelpJarvis { | |
public final static Scanner scanner = new Scanner(System.in); | |
public static void main(String[] args) { | |
int kb = 1024; | |
int numberOfCases = 5000; | |
List<String> list = new ArrayList<>(); | |
for (int i = 0; i < numberOfCases; i++) { | |
String data = "03333"; | |
char[] chars = data.toCharArray(); | |
Arrays.sort(chars); | |
boolean series = true; | |
for (int index = 0; index < chars.length-1; index++) { | |
if (chars[index + 1] - chars[index] != 1) { | |
series = false; | |
System.out.println("NO"); | |
break; | |
} | |
} | |
if (series) { | |
System.out.println("YES"); | |
} | |
} | |
System.out.println("Total Memory in (KB)" + (double) Runtime.getRuntime().totalMemory()/ kb); | |
System.out.println("Actual Memory in (KB): " + (double) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / kb); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment