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 <map> | |
#include <string> | |
std::string decimalToRoman(int n) { | |
std::string roman = ""; | |
const std::map<int, std::string> rd = { | |
{1000, "M"}, | |
{900, "CM"}, | |
{500, "D"}, | |
{400, "CD"}, |
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 <string> | |
// #include <algorithm> | |
// #include <iostream> | |
#include <vector> | |
#include <map> | |
#include <stack> | |
// #pragma once | |
#ifndef BRACES_H |
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 <stdio.h> | |
#include <math.h> | |
#define true 1 | |
typedef double (*mathFn)(double); | |
const double EPS = 1e-9; | |
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
public class InputHandler { | |
// clears the screen | |
public static void clearScreen() { | |
final String ANSI_CLS = "\u001b[2J"; | |
final String ANSI_HOME = "\u001b[H"; | |
System.out.print(ANSI_CLS + ANSI_HOME); | |
System.out.flush(); | |
} | |
} |
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
public class Automata { | |
public static void main(String[] args) { | |
for (String chain : args) { | |
System.out.println(isValidAssignmentChain(chain)); | |
} | |
} | |
public static boolean isValidAssignmentChain(String chain) { |
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
public class Braces { | |
public static void main(String[] args) { | |
for (String line : args) { | |
System.out.println(isValidBracketsSeq(line)); | |
} | |
} | |
static boolean isValidBracketsSeq(String brackets) { |
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
# -*- encoding: utf-8 -*- | |
import sys | |
import os | |
import matplotlib.pyplot as plt | |
import numpy as np # instead of math | |
def getFullPath(fileName, fileType): | |
return (os.getcwd() + '\\' + '{}.{}').format(fileName, fileType) |
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
""" | |
Basic Least Squares Implementation with pseudo inverse | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
np.random.seed(0) | |
t = np.linspace(0, 3, 20) # horizontal axis | |
x = np.array([3, 0, 4]) # a,b,c of f(t)=a+b*t+c*t^2 | |
f = lambda t, x: x[0]+x[1]*t+x[2]*t**2 # f(t) |
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
public class BinarySearchDemoClass { | |
public static int binarySearch(String[] array, String value) { | |
int l = 0, r = array.length; | |
int mid = (l + r) / 2; | |
while (l < r) { | |
if (value.compareTo(array[mid]) == 0) { | |
return mid; | |
} else if (value.compareTo(array[mid]) > 0) { |
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 <stdio.h> | |
#include <math.h> | |
typedef double (*function)(double); | |
double func(double); | |
double integral(function, double, double); | |
const int SECTIONS_QUANTITY = 1e4; | |
// const double EPS = 1e-6; |
OlderNewer