Submitted by: Mohammad Sajid Anwar
You are given a string containing only ( and ).
Write a script to find the length of the longest valid parenthesis.
Input: $str = '(()())'
Output: 6
Valid Parenthesis: '(()())'
Input: $str = ')()())'
Output: 4
Valid Parenthesis: '()()' at positions 1-4.
Input: $str = '((()))()(((()'
Output: 8
Valid Parenthesis: '((()))()' at positions 0-7.
Input: $str = '))))((()('
Output: 2
Valid Parenthesis: '()' at positions 6-7.
Input: $str = '()(()'
Output: 2
Valid Parenthesis: '()' at positions 0-1 and 3-4.
Submitted by: Mohammad Sajid Anwar
You are given a string containing only digits and a target integer.
Write a script to insert binary operators +, - and * between the digits in the given string that evaluates to target integer. Numbers with leading zeroes are invalid and the results should be in lexicographic order.
Input: $str = "123", $target = 6
Output: ("1*2*3", "1+2+3")
Input: $str = "105", $target = 5
Output: ("1*0+5", "10-5")
Input: $str = "232", $target = 8
Output: ("2*3+2", "2+3*2")
Input: $str = "1234", $target = 10
Output: ("1*2*3+4", "1+2+3+4")
Input: $str = "1001", $target = 2
Output: ("1+0*0+1", "1+0+0+1", "1+0-0+1", "1-0*0+1", "1-0+0+1", "1-0-0+1")
Last date to submit the solution 23:59 (UK Time) Sunday 9th November 2025.