SHARECHAT Coding Question – Solved

4 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

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |