Problem 1 Question 4 Part B

will each solution work for all cases