ある数のベクトルが与えられた場合、そのベクトルの要素の一つが他の要素の二乗であれば true を返し、それ以外の場合は false を返すようなコードを書いてみましょう。
例:
入力が a = [2 3 4] のとき、 出力 b は true になります。
2の2乗は4であり、ベクトル内に2と4の両方が含まれているため、出力は true になります。
This appears to be duplicating an error in the original Problem: according to the problem specification, having an input of [1] should yield a result of "false", as there is no OTHER element to compare the 1 to! You can easily fix this inconsistency by either --- changing your problem specification (mention that you can compare to all vector elements, not just the 'other' elements) or --- by changing the correct result to "false" in your Test Suite.
Please check comments made about the original Problem to avoid duplicating errors or inconsistencies.
552 Solvers
631 Solvers
302 Solvers
Matlab Basics II - Count rows in a matrix
178 Solvers
170 Solvers