IBM interview question

Two "leetcode style" questions, one algorithms based, one database.