加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[LeetCode] Image Overlap 图像重叠

发布时间:2020-12-14 04:25:41 所属栏目:大数据 来源:网络整理
导读:? Two images? A ?and? B ?are given,represented as?binary,square matrices of the same size.? (A binary matrix has only 0s and 1s as values.) We translate one image however we choose (sliding it left,right,up,or down any number of units),and

?

Two images?A?and?B?are given,represented as?binary,square matrices of the same size.? (A binary matrix has only 0s and 1s as values.)

We translate one image however we choose (sliding it left,right,up,or down any number of units),and place it on top of the other image.? After,the?overlap?of this translation is the number of positions that have a 1 in both images.

(Note also that a translation does?not?include any kind of rotation.)

What is the largest possible overlap?

Example 1:

Input: A = [[1,1,0],[0,?           [0,0]]
?      B = [[0,1],1]]
Output: 3
Explanation: We slide A to right by 1 unit and down by 1 unit.

Notes:?

  1. 1 <= A.length = A[0].length = B.length = B[0].length <= 30
  2. 0 <=?A[i][j],B[i][j] <= 1
?

s

?

参考资料:

https://leetcode.com/problems/image-overlap/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读