top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Given an array A of n elements, find three indices i,j & k such that A[i]^2+A[j]^2=A[k]^2 ?

+3 votes
952 views
Given an array A of n elements, find three indices i,j & k such that A[i]^2+A[j]^2=A[k]^2 ?
posted Jun 28, 2016 by Shivam Kumar Pandey

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
brute force approach requires n^3 time complexity but I need to solve this problem in n^2 time complexity
http://www.geeksforgeeks.org/find-a-sorted-subsequence-of-size-3-in-linear-time/

its not the algorithm for question, but I think this will be helpful for developing logic for your question,
hope it will be helpful
I'll update you after checking if it fulfills my requirement or not.

...