From 89d90d24190c6f92e90aedce7f4474f888c98a3a Mon Sep 17 00:00:00 2001 From: Lucas Pearson Date: Mon, 23 Sep 2024 19:18:49 -0400 Subject: [PATCH] add validparentheses dsa question This was generated mostly by Google Gemini with some tweaks here and there --- go/validparentheses/README.md | 22 ++++++++++++ go/validparentheses/go.mod | 3 ++ .../more_validparentheses_test.go.gpg | Bin 0 -> 385 bytes go/validparentheses/validparentheses.go | 5 +++ go/validparentheses/validparentheses_test.go | 34 ++++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 go/validparentheses/README.md create mode 100644 go/validparentheses/go.mod create mode 100644 go/validparentheses/more_validparentheses_test.go.gpg create mode 100644 go/validparentheses/validparentheses.go create mode 100644 go/validparentheses/validparentheses_test.go diff --git a/go/validparentheses/README.md b/go/validparentheses/README.md new file mode 100644 index 0000000..1f096c7 --- /dev/null +++ b/go/validparentheses/README.md @@ -0,0 +1,22 @@ +# Problem Statement: +Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: + + Open brackets must be closed by the same type of brackets. + Open brackets must be closed in the correct order. + Every close bracket has a corresponding open bracket of the same type. + +# Example Inputs and Expected Outputs: +Example 1: + + Input: s = "()" + Output: true + +Example 2: + + Input: s = "()[]{}" + Output: true + +Example 3: + + Input: s = "(]" + Output: false diff --git a/go/validparentheses/go.mod b/go/validparentheses/go.mod new file mode 100644 index 0000000..3a404b6 --- /dev/null +++ b/go/validparentheses/go.mod @@ -0,0 +1,3 @@ +module validparentheses + +go 1.23.1 diff --git a/go/validparentheses/more_validparentheses_test.go.gpg b/go/validparentheses/more_validparentheses_test.go.gpg new file mode 100644 index 0000000000000000000000000000000000000000..4cedb0932159dabf1f2b3d15d64c195792251fe9 GIT binary patch literal 385 zcmV-{0e=3B4Fm}T2#&*sXfo_#X8+Q_uK^J#|H}lw?B-5{e*g}mlz#lF3O(3W!-cSq zFgRZE7u{)2#Uq{{jN6=-yrBtpxCewbmdUi+1EzLOcYbB!0P5`bF^fnUv+GWRq=C`r z;-f>M?W2mFWm11qbD(l|#*AhKz@U-yPWl6?27OW9AYB>+)N!sX@DC~oB@lxNX+rIN zi*QyrD$*o`tZHSn9!P$C;OO~&-^&hxE@NC{#4IxD+LGLH6wJOpAAl!6WL&EnWxS@&>1SF*3Q$-gxTLutqkJE$$o+wzy3QiM71^Cv$$6a`>J z0Z$g}59*-uazfcs#tx7e`AHUas(g98c9%x|`8D@Ti4yCD4xMhw1IgJg8 fCiA)Yy7}z7&=^6G&M+O#9P2^-SpEfh0