1577. Number of Ways Where Square of Number Is Equal to Product of Two Numbers
https://leetcode.com/problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers
Description
Given two arrays of integers nums1
and nums2
, return the number of triplets formed (type 1 and type 2) under the following rules:
Type 1: Triplet (i, j, k) if
nums1[i]2 == nums2[j] * nums2[k]
where0 <= i < nums1.length
and0 <= j < k < nums2.length
.Type 2: Triplet (i, j, k) if
nums2[i]2 == nums1[j] * nums1[k]
where0 <= i < nums2.length
and0 <= j < k < nums1.length
.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= nums1.length, nums2.length <= 1000
1 <= nums1[i], nums2[i] <= 10^5
ac
Previous1576. Replace All ?'s to Avoid Consecutive Repeating CharactersNext1578. Minimum Deletion Cost to Avoid Repeating Letters
Last updated