This Week in Dev

Java, Unit Tests, CodeSignal

Up to level 40 this week on - that’s over 100 challenges solved in just a couple weeks

Evaluating Efficiency with Big-O Notation

Check out my recursive solution to this arcade problem, which made it possible for me solve a problem in *constant time* O(1), a whole world of improvement over my previous approach, which turned out to be a *factorial time* O(n!) solution. Big-O notation is a means of evaluating the computational efficiency of different algorithms.

My solution

boolean stringsRearrangement(String[] inputArray) {
    String[] sorted =[]::new);

    // test input that does not include duplicates
    if (inputArray.length ==
            && allStringsConform(sorted)) return true;

    // test starting with each individual input string
    for (String string :[]::new)) {
        ArrayDeque<String> input = new ArrayDeque<>(;
        ArrayDeque<String> output = new ArrayDeque<>(Collections.singletonList(string));
        if (testPermutations(input, output)) return true;

    return false;
[Read More]