Question: 1. Suppose we are given an n-digit integer X. Repeatedly remove one digit from either end of X (your choice) until no digits are left.

1. Suppose we are given an n-digit integer X. Repeatedly remove one digit from either end of X (your choice) until no digits are left. The square-depth of X is the maximum number of perfect squares that you can see during this process. For example, the number 32492 has square-depth 3, by the following sequence of removals: 32492 32492 3249 324 24 4 Suppose we are given an integer X, represented as an array X[1 .. n] of n decimal digits. Further suppose we have access to a subroutine IsSouare that determines whether a given k-digit number (represented by an array of digits) is a perfect square in O(k2) time (a) For any i, j such that 1 i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
