Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 520 characters in body
Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (JDK), 4 bytes

A->9

Try it online!

Outputs the number 9 which as a character is the average character of the code.

Defined as a int f(Void v). Note that Void is an accepted argument type for "no input" challenges.

If an int isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.

vA->67>56

Try it online! Try it online!

Outputs C8 which is the average character.

Defined as a char f(Void v). I was surprised that no casting to char was required, but it beats v->';' by one byte.

Java (JDK), 4 bytes

A->9

Try it online!

Outputs the number 9 which as a character is the average character of the code.

Defined as a int f(Void v). Note that Void is an accepted argument type for "no input" challenges.

If an int isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.

v->67

Try it online!

Outputs C which is the average character.

Defined as a char f(Void v). I was surprised that no casting to char was required, but it beats v->';' by one byte.

Java (JDK), 4 bytes

A->9

Try it online!

Outputs the number 9 which as a character is the average character of the code.

Defined as a int f(Void v). Note that Void is an accepted argument type for "no input" challenges.

If an int isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.

A->56

Try it online!

Outputs 8 which is the average character.

Defined as a char f(Void v). I was surprised that no casting to char was required, but it beats v->';' by one byte.

added 520 characters in body
Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (JDK), 54 bytes

A->9

Try it online!

Outputs the number 9 which as a character is the average character of the code.

Defined as a int f(Void v). Note that Void is an accepted argument type for "no input" challenges.

If an int isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.

v->67

Try it online!

Outputs C which is the average character.

Defined as a char f(Void v) lambda. I was surprised that no casting to char was required, but it beats v->';' by one byte. Note that Void is an accepted argument type for "no input" challenges.

Java (JDK), 5 bytes

v->67

Try it online!

Outputs C which is the average character.

Defined as a char f(Void v) lambda. I was surprised that no casting to char was required, but it beats v->';' by one byte. Note that Void is an accepted argument type for "no input" challenges.

Java (JDK), 4 bytes

A->9

Try it online!

Outputs the number 9 which as a character is the average character of the code.

Defined as a int f(Void v). Note that Void is an accepted argument type for "no input" challenges.

If an int isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.

v->67

Try it online!

Outputs C which is the average character.

Defined as a char f(Void v). I was surprised that no casting to char was required, but it beats v->';' by one byte.

Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (JDK), 5 bytes

v->67

Try it online!

Outputs C which is the average character.

Defined as a char f(Void v) lambda. I was surprised that no casting to char was required, but it beats v->';' by one byte. Note that Void is an accepted argument type for "no input" challenges.

AltStyle によって変換されたページ (->オリジナル) /