This file contains hidden or 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
# Function to compile file if it's been modified. | |
compile() { | |
basename=$1 | |
code_timestamp=$(stat -f '%c' "$basename.cpp") | |
executable_timestamp=$(stat -f '%c' "$basename") | |
if [[ code_timestamp -ge executable_timestamp ]]; then | |
echo "Compiling $basename.cpp" | |
g++ -std=c++14 "$basename.cpp" -o $basename | |
fi | |
} |
This file contains hidden or 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 random | |
import time | |
import sys | |
from string import ascii_lowercase | |
class Individual: | |
def __init__(self, name, fitness = 0.0): | |
self.name = name | |
self.fitness = fitness |
This file contains hidden or 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
/* | |
* Deleted code is debugged code :) | |
*/ | |
#include <bits/stdc++.h> | |
#define ll long long | |
#define ull unsigned long long | |
#define vi vector<int> | |
#define vll vector<ll> | |
#define vvi vector<vector<int>> | |
#define vvll vector<vector<ll>> |
This file contains hidden or 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.Random; | |
import java.util.Scanner; | |
class Square { | |
private boolean hasMine; | |
private boolean isOpened; | |
private boolean isMarked; | |
private int mineCount; | |
private static final int neighbourCount = 8; |
This file contains hidden or 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> | |
using namespace std; | |
class Demo { | |
private: | |
int dataSize; | |
int* data; | |
public: | |
explicit Demo(int size) : dataSize(size), data(new int[size]) { |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
template<typename T> | |
void printer(T first) { | |
cout << first << "\n"; | |
} | |
template<typename T, typename... Args> | |
void printer(T first, Args... args) { |
This file contains hidden or 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
class TrieNode { | |
private: | |
const int CHILDREN_SIZE = 26; | |
bool wordEnds; | |
vector<TrieNode*> children; | |
public: | |
TrieNode() { | |
wordEnds = false; | |
children.resize(CHILDREN_SIZE); |
This file contains hidden or 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
class Solution { | |
public: | |
long mirror(long num) { | |
string mirrored = to_string(num); | |
int i = 0, j = mirrored.length() - 1; | |
while (i < j) { | |
mirrored[j--] = mirrored[i++]; | |
} | |
return stol(mirrored); | |
} |
This file contains hidden or 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
.MODEL SMALL | |
.DATA | |
STR1 DB 5 DUP(' '),'$' | |
STR2 DB 5 DUP(' '),'$' | |
NL DB 0DH,0AH,'$' | |
.CODE | |
MAIN PROC | |
MOV AX,@DATA | |
MOV DS,AX |
This file contains hidden or 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
.MODEL SMALL | |
.DATA | |
STR1 DB 5 DUP(' '),'$' | |
NL DB 0DH,0AH,'$' | |
PRINTPAL DB 0DH,0AH,"PALINDROME$" | |
PRINTNOTPAL DB 0DH,0AH,"NOT PALINDROME$" | |
OKAY DB 0DH,0AH,"MATCH FOUND$" | |
.CODE | |
MAIN PROC | |
MOV AX,@DATA |
NewerOlder