The other day, I had the following problem in the coding test.
I didn't understand well because the meaning of the question sentence was English.
Implement function verify (text) which verifies whether parentheses within text are
correctly nested. You need to consider three kinds: (), ,<>and only these kinds.
Examples: Examples: verify ("--- (++++) ----")->1 verify ("")->1 verify ("before (middle ) after")->1 verify (") (")->0 verify ("<(>)")->0 verify ("([<>()]<>)")->1 verify ("([)")->0
Implement the function verify (text) to verify that the parentheses in the text are properly nested
Only three types, (), , and<>, need to be considered.
However, I didn't understand the meaning of the problem statement.
I'm guessing, but I think I should check if there are parentheses in the argument of the verify function.
I think, but I can't confirm it.
The meaning of someone's question,
And if there is any reference to solve it
I would appreciate it if you could tell me.
Answer # 1
Isn't it simply possible to get the correspondence between parentheses (including the nested structure)?
)  (,
Answer # 2
You could create a function that takes a string as an argument and checks if the parentheses correspond in the argument.
Answer # 3
If it's a common programming language, it's probably true, but it's about whether the opening and closing brackets correspond properly.
Also, since any string is included in the parentheses, if another kind of parenthesis appears there, it is necessary to check the correspondence between the opening parenthesis and the closing parenthesis.
)Must be closed with, for example
]Before the inner parenthesis is closed with
)If the outer parenthesis is closed with, it will be NG. (This is a nested case)
Do you understand the explanation?
- c++ - i don't understand the meaning of the code (#define rcc ((rcc_typedef *) rcc_base)
- ruby on rails 5 - i do not understand the meaning of self in the model
- i don't understand the meaning of a c++ error
- function call i want to understand the meaning of the problem statement
- c++ - i want to understand the meaning of the part i do not understand because the description of the code that fixes the frame
- i don't understand the meaning of using ":" in sql
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- python - you may need to restart the kernel to use updated packages error
- python 3x - typeerror: 'method' object is not subscriptable
- xcode - pod install [!] no `podfile 'found in the project directory
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- android studio - unresolved reference comes out in kotlin