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
public class DebugUtil { | |
public static String stackHash() { | |
try { | |
// code from https://www.baeldung.com/java-stacktrace-to-string | |
StringWriter sw = new StringWriter(); | |
PrintWriter pw = new PrintWriter(sw); | |
new RuntimeException().printStackTrace(pw); | |
// checksuming for speed | |
int sum = 0; |
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.math.BigInteger; | |
public class PrimeMainMR { | |
public static int cnt = 0; | |
// this is the RabinMiller test, deterministically correct for n < 341,550,071,728,321 | |
// http://rosettacode.org/wiki/Miller-Rabin_primality_test#Python:_Proved_correct_up_to_large_N | |
public static boolean isPrime(BigInteger n, int precision) { | |
if (n.compareTo(new BigInteger("341550071728321")) >= 0) { |
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 kotlin.math.pow | |
object PrimeMainComplex { | |
class PrimeChecker(i: Int) { | |
companion object { var zero = 0 } | |
var num = 0 | |
var self: PrimeChecker | |
init { |
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 math | |
import time | |
import six | |
if six.PY2: | |
# In python2, range returns a list instead of an iterator. When running on a large range, | |
# this can take up all of the available memory and crash the process. | |
range = xrange | |
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
const MAX_NUMBER = 10 ** 9; | |
let cnt = 0 | |
function isPrime(num) { | |
if (num === 2) { | |
return true; | |
} | |
if (num < 2 || num % 2 === 0) { | |
return false; | |
} |
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
public class Main { | |
private static final int SIZE = 5_000_000; | |
private static final int[] arr1 = initArray(SIZE); | |
private static final int[] arr2 = initArray(SIZE); | |
public static void main(String[] args) throws InterruptedException { | |
// warmup | |
long[] results = new long[6]; | |
results[0] = twoLoops(); | |
results[1] = oneLoop(); |
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
public static void main(String[] argv) throws InterruptedException { | |
Executors.newVirtualThreadPerTaskExecutor(). | |
execute(() -> { | |
System.out.print("StringList: " + stringList); | |
}); | |
stringList = List.of("ZZ", "XX", "LL", "DDD"); | |
} |
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.Scanner; | |
public class Main { | |
private static final String WORD = "LYMPH"; | |
private static final String[] DICTIONARY = {"CRATE", "USING", "LYMPH", "LUMPS", "LOOMS"}; | |
public static void main(String[] args) { | |
System.out.println("Write a guess:"); | |
Scanner scanner = new Scanner(System.in); | |
int attempts = 0; | |
for(String line = scanner.nextLine() ; line != null ; line = scanner.nextLine()) { |
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
aahed | |
aalii | |
aargh | |
aarti | |
abaca | |
abaci | |
aback | |
abacs | |
abaft | |
abaka |
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
Feature | VS Code | Comments | Links | |
---|---|---|---|---|
Breakpoint | ✅ | Video, Post | ||
Conditional Breakpoint | ✅ | Video, Post | ||
Logpoint/Tracepoint | ✅ | Video, Post | ||
Step Over | ✅ | Video, Post | ||
Step Into | ✅ | Video, Post | ||
Step Out | ✅ | Video, Post | ||
Continue | ✅ | Video, Post | ||
Run to Cursor | ✅ | Video, Post | ||
Return Immediately | ❌ | Restart Frame is available | Video, Post |
OlderNewer