In reply to Huzefa Halolwala: There is no need for solve A before length because the function call implies this.