Skip to main content
Commonmark migration
Source Link

#Java 7, 77 74 bytes

Java 7, 77 74 bytes

boolean c(String s){int r=0;for(int c:s.getBytes())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.
-3 bytes thanks to @SuperChafouin.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.getBytes())     //  For each character in the String (as integer value)
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

#Java 7, 77 74 bytes

boolean c(String s){int r=0;for(int c:s.getBytes())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.
-3 bytes thanks to @SuperChafouin.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.getBytes())     //  For each character in the String (as integer value)
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

Java 7, 77 74 bytes

boolean c(String s){int r=0;for(int c:s.getBytes())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.
-3 bytes thanks to @SuperChafouin.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.getBytes())     //  For each character in the String (as integer value)
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method
-3 bytes by replacing toCharArray with getBytes
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 7, 7777 74 bytes

boolean c(String s){int r=0;for(int c:s.toCharArraygetBytes())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.
-3 bytes thanks to @SuperChafouin.

Explanation:

Try it here.Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.toCharArraygetBytes())     //  For each character in the String (as integer value)
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

#Java 7, 77 bytes

boolean c(String s){int r=0;for(int c:s.toCharArray())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.toCharArray())  //  For each character in the String
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

#Java 7, 77 74 bytes

boolean c(String s){int r=0;for(int c:s.getBytes())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.
-3 bytes thanks to @SuperChafouin.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.getBytes())     //  For each character in the String (as integer value)
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method
Made case-insensitive
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 7, 77 bytes

boolean c(String s){int r=0;for(int c:s.toCharArray())r+=c-96;returnr+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.

Explanation:

Try it here.Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.toCharArray())  //  For each character in the String
    r+=c-96;r+=c&31;                  //   Sum it's decimalits valuealphabetic 1-indexed 96index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

#Java 7, 77 bytes

boolean c(String s){int r=0;for(int c:s.toCharArray())r+=c-96;return r==100;}

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.toCharArray())  //  For each character in the String
    r+=c-96;                  //   Sum it's decimal value - 96
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method

#Java 7, 77 bytes

boolean c(String s){int r=0;for(int c:s.toCharArray())r+=c&31;return r==100;}

Case-insensitive thanks to @Neil by changing c-96 to c&31.

Explanation:

Try it here.

boolean c(String s){          // Method with String parameter and boolean return-type
  int r=0;                    //  Resulting sum-integer
  for(int c:s.toCharArray())  //  For each character in the String
    r+=c&31;                  //   Sum its alphabetic 1-indexed index (case-insensitive)
                              //  End of loop (implicit / single-line body)
  return r==100;              //  return if the sum equals 100
}                             // End of method
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading