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
package com.example.demo; | |
import java.util.Arrays; | |
public class FillRegionsMapInterviewTask { | |
// The Four-Color Theorem | |
// | |
// In mathematics, the four color theorem, or the four color map theorem, | |
// states that no more than four colors are required to color the regions | |
// of any map so that no two adjacent regions have the same color. |
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
package appstart.mymodappdemo; | |
public class WaitNotifyForThreads { | |
public static void main(String[] args) { | |
Store store = new Store(); | |
Producer producer = new Producer(store); | |
Consumer consumer = new Consumer(store); | |
new Thread(producer).start(); |
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
package appstart.mymodappdemo; | |
import java.util.concurrent.Semaphore; | |
public class JavaSemaphoreApp { | |
public static void main(String[] args) { | |
Semaphore sem = new Semaphore(1); // how many times we can 'acquire' permission | |
CommonResource res = new CommonResource(); |
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
package appstart.mymodappdemo; | |
import java.util.concurrent.locks.ReentrantLock; | |
import java.util.concurrent.locks.Condition; | |
public class ReentrantLockApp { | |
public static void main(String[] args) { | |
Store store = new Store(); |
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 <SoftwareSerial.h> | |
// Arduino Nano 0 - RX 1 - TX | |
SoftwareSerial mySerial(0, 1); | |
void setup() { | |
Serial.begin(115200); | |
while (!Serial); |
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
Приложение: Менеджер карт | |
У Клиента есть набор различных карт (дебетовые, кредитные, скидочные) различных банков. | |
Каждая карта имеет номер, тип, дату истечения (месяц и год). | |
Номер карты представлен 20 символьной цифровой последовательностью. | |
Имя банка или магазина определяется первыми 4 символами номера. | |
Реализовать функциональность работы с картами клиента (добавление/удаление), | |
вывод списка клиентов и информацию о количестве его карт (с сортировкой по имени клиента) | |
вывод в консоль информацию в удобно читаемом виде по всем картам у конкретного клиента (в порядке убывания количества карт у клиента) |
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
version: '3.1' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
environment: | |
- ZOOKEEPER_CLIENT_PORT=2181 | |
- ZOOKEEPER_TICK_TIME=2000 | |
ports: | |
- "32181:2181" |
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 RandomStringUtils { | |
private static final SecureRandom RANDOM = new SecureRandom(); | |
private static final String cyrillicCharacters = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; | |
public static String generateRandomCharacter(){ | |
int randomCharIndex = RANDOM.nextInt(cyrillicCharacters.length()); | |
return String.valueOf(cyrillicCharacters.charAt(randomCharIndex)); | |
} | |
} |
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
/* | |
* Learning C++ Best Practices :: Avoid Defining Any Default Operations, Or Define Them All (Jason Turner) | |
* https://learning.oreilly.com/videos/learning-c-best/9781491954898/9781491954898-video241545 | |
*/ | |
#include <string> | |
struct S { | |
~S() {}; | |
std::string s; |
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> | |
// Example from Jason Turner's video. | |
// https://youtu.be/JtUZmkvroKg?t=290 | |
template <typename T> | |
void print(T i, const std::string_view s) { | |
std::cout << i << ' ' << s << '\n'; | |
} |
NewerOlder