Skip to content

Instantly share code, notes, and snippets.

Avatar

Lukas K Jacomin lukaskj

View GitHub Profile
@lukaskj
lukaskj / solution.php
Created Dec 14, 2020
BairesDev - Technical Test - Lukas Jacomin
View solution.php
<?php
function balancedBrackets($str) {
$openingBrackets = ["[", "(", "{"];
$closingBrackets = ["]", ")", "}"];
$stack = [];
for ($i = 0; $i < strlen($str); $i++) {
if (in_array($str[$i], $openingBrackets)) {
$stack[] = $str[$i];