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.EmptyStackException; | |
import java.util.Map; | |
import java.util.Stack; | |
public class Solution { | |
public static void main(String[] args) { | |
System.out.println(isCorrectBrackets("[{}]")); | |
System.out.println(isCorrectBrackets("[{]}")); | |
System.out.println(isCorrectBrackets("[{}{}{}{}]")); |
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
/* | |
We are developing a new board game, Thrilling Teleporters. | |
The board consists of consecutive squares from 0 to last_square, some of the spaces also contain Teleporters, which are given as comma delimited strings "from,to". | |
The game is played as follows: | |
1. Each turn, the player rolls a die numbered from 1 to die_sides. | |
2. The player moves forward the rolled number of squares. | |
3. The player stops at last_square if they reach it. | |
4. If the player finishes on a square with a teleporter, they are moved to where the teleporter points. |
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
/* | |
We have a two-dimensional board game involving snakes. The board has two types of squares on it: +'s represent | |
impassable squares where snakes cannot go, and 0's represent squares through which snakes can move. | |
Snakes can only enter on the edges of the board, and each snake can move in only one direction. | |
We'd like to find the places where a snake can pass through the entire board, moving in a straight line. | |
Here is an example board: | |
col--> 0 1 2 3 4 5 6 | |
+---------------------- |
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
/* | |
Longest Common Prefix | |
Example 1: | |
Input: strs = ["flower","flow","flight"] | |
Output: "fl" | |
Example 2: | |
Input: strs = ["dog","racecar","car"] | |
Output: "" |
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
public class MovingAverage { | |
private final int[] array; | |
private int index; | |
private long sum; | |
public MovingAverage(int size) { | |
this.array = new int[size]; | |
this.index = 0; | |
} |
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
# iperf3 server start | |
iperf3 -s | |
# standard client check from client to server | |
iperf3 -t 30 -c <IP> | |
# reverse client check from server to client | |
iperf3 -t 30 -R -c <IP> | |
# public iperf servers |
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
[Unit] | |
Description=SoftEther VPN Server | |
After=network.target auditd.service | |
ConditionPathExists=!/opt/vpnserver/do_not_run | |
[Service] | |
Type=forking | |
EnvironmentFile=-/opt/vpnserver | |
ExecStart=/opt/vpnserver/vpnserver start | |
ExecStartPost=/bin/sleep 3s |
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
cd /opt/vpnserver | |
# Создаем новый tap-интерфейс, где: | |
# VPN - название созданного хаба, | |
# /DEVICE - часть названия tap-интерфейса, которое будет добсавлено к "tap_" | |
./vpncmd localhost:5555 /SERVER /CMD BridgeCreate VPN /DEVICE:vpn /TAP:yes | |
# Проверяем ново-созданный интерфейс | |
# Status должен быть "Operating" | |
./vpncmd localhost:5555 /SERVER /CMD BridgeList |
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
cd /opt/vpnserver/ | |
# Включение SecureNat | |
./vpncmd localhost:5555 /SERVER /HUB:VPN /CMD SecureNatEnable | |
# Установка mac адреса, ip адреса и маски хаба, где: | |
# /IP - ip-адрес вируального роутера хаба | |
# /MASK - его маска | |
# /MAC - MAC-адрес | |
./vpncmd localhost:5555 /SERVER /HUB:VPN /CMD SecureNatHostSet /MAC:00-11-22-33-44-55 /IP:192.168.234.1 /MASK:255.255.255.0 |
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
cd /opt/vpnserver/ | |
# Проверка сервера | |
./vpncmd /TOOLS /CMD Check | |
# Отключение Keep Alive Internet Connection | |
./vpncmd localhost:5555 /SERVER /CMD KeepDisable | |
# Выбор более устойчивого алгоримта шифрования чем установлен по умолчанию | |
./vpncmd localhost:5555 /SERVER /CMD ServerCipherSet AES256-SHA |
NewerOlder