(1.1) Is Unique

Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?

related blog post

function hasAllUniqueChars(subject: string): boolean {
    let foundChars: string[] = [];
    for (let i = 0; i < subject.length; i++) {
        for (let j = 0; j < foundChars.length; j++) {
            if (subject[i] === foundChars[j]) return false;
        }
        foundChars.push(subject[i]);
    }
    return true;
}
function hasAllUniqueCharsWithoutUsingAdditionalDataStructures(subject: string): boolean {
    for (let i = 0; i < subject.length; i++) {
        for (let j = i; j < subject.length; j++) {
            if (subject[j] === subject[i]) return false;
        }
    }
    return true;
}