Cyware Interview Question

two DSA coding problems with time complexity reasoning