Skip to content

Instantly share code, notes, and snippets.

View prianichnikov's full-sized avatar

Maksim Prianichnikov prianichnikov

View GitHub Profile
@prianichnikov
prianichnikov / Solution.java
Created November 8, 2023 15:03
Thrilling Teleporters game
/*
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.
@prianichnikov
prianichnikov / Solution.java
Created November 14, 2023 12:24
Find correct brackets
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("[{}{}{}{}]"));