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
// ... | |
// @grant GM_registerMenuCommand | |
// @grant GM_unregisterMenuCommand | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// ... | |
class GM_Cyclic_Config { | |
constructor({ | |
key, |
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
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
/** | |
* @brief Fibonacci min heap. | |
*/ | |
template <typename T> | |
class FibbHeap |
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
// I don't like null | |
#include <optional> | |
// For to_string() | |
#include <string> | |
#include <sstream> | |
template <typename T> | |
class SinglyLinkedList | |
{ | |
private: | |
struct SLLNode |
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
char data = 0; | |
bool flip = true; | |
void setup() | |
{ | |
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission | |
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin | |
} | |
void loop() | |
{ | |
if(Serial.available() > 0) // Send data only when you receive data: |
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
# define knowledge base | |
class knowledgeBase: | |
class mappingIterator: | |
def __init__(self, key, mappings): | |
self.mappings = mappings | |
self.key = key | |
self.maxlevel = 0 | |
self.curlevel = -1 | |
self.isEmpty = not key in mappings | |
if self.isEmpty: |
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
""" | |
Write a program that repeatedly prompts a user for integer numbers untill the user enters 'done'. | |
Once 'done' is entered print out the largest and smallest of the numbers. | |
If user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. | |
Enter 7, 2, bob, 10 and 4 and match the output. | |
Invalid input | |
Maximum is 10 | |
Minimum is 2 | |
""" |
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
/** | |
* Question found here: https://www.codechef.com/OCT18B/problems/MINDSUM | |
* | |
* You are given positive integers N and D. | |
* You may perform operations of the following two types: | |
* add D to N, i.e. change N to N+D | |
* change N to digitsum(N) | |
* Here, digitsum(x) is the sum of decimal digits of x. | |
* For example, digitsum(123)=1+2+3=6 and digitsum(100)=1+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
T = int(input()) | |
while(T>0): | |
T-=1 | |
inp = input() | |
prevRange = 0 | |
dist = 55 # max dist. (=infinity) for first robot | |
collision = False | |
# iterate through input string | |
for c in inp: |
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
// Example program | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
class Person | |
{ | |
public: | |
Person(){} |
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.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
public class SaltedSBox { | |
private final Random rand; |
NewerOlder