for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Lesson05;
class Nesting
{
public function solution($S)
$length = strlen($S);
if ($length) {
$parentheses = [];
for ($i = 0; $i < $length; $i++) {
if ($S[$i] == '(') {
array_push($parentheses, '(');
} elseif ($S[$i] == ')') {
if (empty($parentheses)) {
return 0;
}
array_pop($parentheses);
return 1;
} else {