Problem 44074. GJam 2017 Kickstart: Parentheses (Small)
This Challenge is derived from GJam 2017 Kickstart Parentheses. This is the first 100 small cases with max L+R<=20.
Google Code Jam 2017 Qualifier is March 7, 2017. Typically four challenges with small and large aspects with 27 hours to complete.
The GJam story is given L left and R right parentheses determine the maximum number of parentheses pairings.
Input: [L,R], the quantity of parentheses types
Output: [V], the maximum number of parentheses pairings
Examples: [L,R] [V]; [3,2] [3]
For the case ()()(, for example, the three balanced groups are () from indexes 1 to 2, () from indexes 3 to 4, and ()() from indexes 1 to 4.
Theory: Brute force permutations and counting will not succeed in a timely manner for L+R=20. Determining the inherent mathematical pattern is usually the best way to succeed in GJam. GJam Kickstart solutions(C++,Python).
Solution Stats
Problem Comments
-
3 Comments
It's a pleasure to see you again Richard.
Welcome back, Richard. I have a question on the scoring - Would (()) count as one (Left 2 and Right 3) or two (L1 and R4, and L2 and R3)? I guess the more general question is can you have a balanced string inside of another balanced string?
Something seems to be amiss--this page says "5 solutions," but the graph is empty, and clicking "5 solutions" produces "No results." The main page says "0 solutions" but also " Solved."
Solution Comments
Show commentsProblem Recent Solvers18
Suggested Problems
-
1756 Solvers
-
Sum the numbers on the main diagonal
574 Solvers
-
4917 Solvers
-
386 Solvers
-
Sum the 'edge' values of a matrix
338 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!