Finding the Longest Square Streak
Given an integer array nums, a subsequence of nums is called a "square streak" if the following conditions are met:
-The length of the subsequence is at least 2. -After sorting the subsequence, each element (except the first element) is the square of the previous number. Your task is to find the length of the longest square streak in nums and print it, or print -1 if there is no square streak.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)