Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basildoesstuff/c46c54c02f0a6f483e71dc11b4ede534 to your computer and use it in GitHub Desktop.
Save basildoesstuff/c46c54c02f0a6f483e71dc11b4ede534 to your computer and use it in GitHub Desktop.
#q3
L = [10, 99, 98, 85, 45, 59, 65, 66, 76, 12, 35, 13, 100, 80, 95]
for i in L:
if i==100:
print("There is 100 at index "+ str(L.index(100)))
#q4
def is_even(n):
if n%2==0:
return True
else:
return False
@basildoesstuff
Copy link
Author

import java.math.BigInteger;
import java.lang.Math;

class Grains {

BigInteger grainsOnSquare(final int square) {
  if(square <=64 && square >0  )  
      return BigInteger.valueOf(2).pow(square - 1);
  else  
     throw new IllegalArgumentException("square must be between 1 and 64");
}

BigInteger grainsOnBoard() {        
    return BigInteger.valueOf(2).pow(64).subtract(BigInteger.valueOf(1));
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment