Swiggy | Square Investment | OA | Square Investment

Swiggy · Question · Posted Apr 2026

Problem Statement: Square Investment The Objective: Bob and John each have N dollars. They invest amounts i and j respectively (1≤i,j≤N). Their return is calculated as i×j. Your task is to find the number of pairs (i,j) such that the return is a perfect square. Example Walkthrough: Input: N=4 Output: 6 Pairs: (1,1)→1×1=12 (1,4)→1×4=22 (2,2)→2×2=22 (3,3)→3×3=32 (4,1)→4×1=22 (4,4)→4×4=42  

The full answer & interview discussion are available to premium members.

Log in Create a free account