ServiceNow Interview Question

2 Leetcode style coding questions.