This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class GradeCalculator { | |
public static void main(String[] args) { | |
try (Scanner input = new Scanner(System.in)) { | |
while (true) { | |
System.out.print("Please enter your grade: "); | |
double grade = input.nextDouble(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.annotations.Contract; | |
import org.jetbrains.annotations.NotNull; | |
import java.math.BigInteger; | |
public class LargeFibonacci { | |
public static void main(String[] args) { | |
BigInteger x = new BigInteger("0"); | |
BigInteger y = new BigInteger("1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def b_to_int(b): | |
b_l = len(b) | |
x = 0; | |
i = 0 | |
while i < b_l: | |
x += int(b[i]) * 2 ** (b_l - i - 1) | |
i = i + 1 | |
return x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goal: Find logical difference between "a AND (b OR NOT c)" and "a AND b OR NOT c" | |
import random | |
chars = ["T", "F"] | |
combinationgram = [] | |
i = 0 | |
while i < 2 ** 3: | |
combination = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
binary = '101111000011010101100000'; | |
bin_len = len(binary) | |
x = 0; | |
i = 0 | |
while i < bin_len: | |
x += int(binary[i]) * 2 ** (bin_len - i - 1) | |
i = i + 1 | |
print(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 102385; # Can be any unsigned integer of your liking. | |
bin = '' | |
while x != 0: | |
z = x % 2; | |
x = (x / 2) - (z / 2) | |
bin += str(int(z)) | |
print(bin[::-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($configuration->requestList as $request) { | |
$video = $request->video; | |
$endpoint = $request->endpoint; | |
$lowestLatency = $endpoint->dataCenterLatency; | |
$selectedCache = null; | |
/** | |
* @var int $id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private static function getVectorFromConnection(int $connection): ?Vector3 | |
{ | |
switch ($connection) { | |
case 2: | |
return new Vector3(0, 0, -1); | |
break; | |
case 3: | |
return new Vector3(0, 0, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
MIT License | |
Copyright (c) 2018 Shaheryar Sohail | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |