Union of Two Arrays
Convert both arrays to sets, take the union, and sort the result if stable output is helpful.
Return the unique values that appear in either array.
Quick recall
Convert both arrays to sets, take the union, and sort the result if stable output is helpful.
Return the unique values that appear in either array.
Push opening brackets onto a stack and pop when you see a matching closer. Any mismatch or leftover opening bracket means the string is invalid.
Check whether brackets in a string are balanced and properly nested.