LeetCode --- 1346. Check If N and Its Double Exist 解题报告

Posted 杨鑫newlfe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1346. Check If N and Its Double Exist 解题报告相关的知识,希望对你有一定的参考价值。

Given an array arr of integers, check if there exist two indices i and j such that :

  • i != j
  • 0 <= i, j < arr.length
  • arr[i] == 2 * arr[j]

Example 1:

Input: arr = [10,2,5,3]
Output: true
Explanation: For i = 0 and j = 2, arr[i] == 10 == 2 * 5 == 2 * arr[j]

Example 2:

Input: arr = [3,1,7,11]
Output: false
Explanation: There is no i and j that satisfy the conditions.

Constraints:

  • 2 <= arr.length <= 500
  • -103 <= arr[i] <= 103

所有代码均可在Github中找到:

以上是关于LeetCode --- 1346. Check If N and Its Double Exist 解题报告的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode --- 1346. Check If N and Its Double Exist 解题报告

[LeetCode] 1346. 检查整数及其两倍数是否存在

leetcode1346.检查整数及两倍数是否存在(c/c++/java)

leetcode1346.检查整数及两倍数是否存在(c/c++/java)

⭐算法入门⭐《二分枚举》简单04 —— LeetCode 1346. 检查整数及其两倍数是否存在

LeetCode 958. Check Completeness of a Binary Tree