Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

additional data structures

public static boolean isUniqueChars(String str) {
    long checker1 = 0;
    long checker2 = 0;
    long checker3 = 0;
    long checker4 = 0;
    for (int i = 0; i < str.length(); ++i) {
        int val = str.charAt(i);
        int toCheck = val / 64;
        val %= 64;
        switch (toCheck) {
            case 0:
                if ((checker1 & (1L << val)) > 0) {
                    return false;
                }
                checker1 |= (1L << val);
                break;
            case 1:
                if ((checker2 & (1L << val)) > 0) {
                    return false;
                }
                checker2 |= (1L << val);
                break;
            case 2:
                if ((checker3 & (1L << val)) > 0) {
                    return false;
                }
                checker3 |= (1L << val);
                break;
            case 3:
                if ((checker4 & (1L << val)) > 0) {
                    return false;
                }
                checker4 |= (1L << val);
                break;
        }            
    }
    return true;
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: callback ref typescript 
Typescript :: depth-first search that chooses values for one variable at a time and returns when a variable has no legal values left to assign 
Typescript :: ts remainder of Division 
Typescript :: serenity-is change button text 
Typescript :: how to set value to readonly property in typescript 
Typescript :: Custom _App with getInitialProps typescript example 
Typescript :: migrate to typescript 
Typescript :: useappdispatch 
Typescript :: calling funcionts in bash 
Typescript :: angular services status return 400 response 
Typescript :: modifying 2d lists python 
Typescript :: how to pass multiple ports in values.yaml of helm 
Typescript :: get database num hits django 
Typescript :: requierd one of two attribute in obj js ts 
Typescript :: .htaccess Forcing scripts to display as source code 
Typescript :: write getter angular 
Typescript :: Which Protect Presentation option protects a presentation from accidental changes: 
Typescript :: which network device reads the source and destination MAC addresses, looks up the destination to determine where to send the frame, and forwards it out to the correct port 
Typescript :: how to send attachments to api 
Typescript :: Type annotations can only be used in TypeScript files.Vetur(8010) 
Typescript :: top 100 employers in the united states 
Typescript :: angular8 PrimeNg tabview 
Typescript :: Defects and Defect Density of quality software 
Typescript :: conda reload environments 
Typescript :: convert angle to 0-360 godot 
Typescript :: python list comports on windows 
Typescript :: typescript isvalidguid 
Typescript :: fieldmatch cannot be resolved to a type 
Typescript :: About half of divorced parents try to avoid each other after the divorce, creating a different set of rules for children to follow in each parent’s household. This type of parental interaction is called 
Typescript :: print gets opened whenever pdf is opened 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =