SHARECHAT Coding Question – Solved

10 Live
Task Calculate the number of pairs of investment (i, j) such that the return is a perfect square. Example 1 Assumptions Input N = 4 Output: 6 Approach (1, 1), (1, 4), (2, 2), (3, 3), (4, 1), and (4, 4) are the possible pairs. Square Investment Bob and John both have N dollars each and want to invest some money in Jack. They will invest amounts i, j (1 ≀ i, j ≀ N). Jack has promised them a return of i * j. Bob and John will be happy if the return is a perfect square. Function Description Complete the function solution(). The function takes the following parameter and returns the solution: - N: Represents the total amount. Input Format for Custom Testing Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code. - The first linecontains N, denoting the total amount. Output Format Return an integer representing the number of possible pairs.

Asked in: SHARECHAT

Image of the Question

Question Image Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |