You are asked to solve two independent coding questions.
Given the roots of two binary trees p and q, return true if they are structurally identical and all corresponding nodes have the same value; otherwise return false.
Input: Two tree roots p, q (each node has val, left, right).
Output: Boolean.
Constraints (typical):
0 <= number_of_nodes <= 10^4
Given a string s consisting only of the characters '(' , ')' , '{' , '}' , '[' , ']', determine whether the input string is valid.
A string is valid if:
Input: String s.
Output: Boolean.
Constraints (typical):
0 <= |s| <= 10^5
After implementing each solution, write a few test cases that cover normal cases and edge cases.