Question: Given the string below, find the longest substring that is a valid Dyck expression and return the length of this valid substring. A Dyck expression
Given the string below, find the longest substring that is a valid Dyck expression and return the length of this valid substring. A Dyck expression is a balanced string of brackets. The set of Dyck words forms a Dyck language. For instance, the following expression is a valid Dyck expression: a bc d The following expressions are NOT valid Dyck languages: a In this case, the method should return since only a is valid
Examples:
a the function returns a and the answer is
ab this is valid, so the answer is
ab the function returns a b and the answer is
a bcdprime the function returns cd and the answer is
Find the longest substring that is a valid Dyck expression and return the length of this valid substring:
smHIBfOOprVAWhTmgfFlxRSUWClDNQSNBaYJTHfpGZEAHa
kzgSqkcSFzcFdhgcBbDdwKhgVtOfruNn
Attempt #: Score:
Allowed attempts: Retry penalty:
Find the longest substring that is a valid Dyck expression and return the length of this valid substring:
s 'egcaGMgzROGwVvcYVwJXKfFmlWDgrFPRMSSrBXyVzz
pZjTVgqifDOhWeptUavfWuMWggiZvNqYTq
Points possible:
Allowed attempts: Retry penalty:
Already tried and from my previous code, both wrong. It is supposed to be in python. Any help is appreciated.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
