leetcode 661 Image Smoother
来源:互联网 发布:python 并行编程 编辑:程序博客网 时间:2024/06/09 15:01
class Solution { public int[][] imageSmoother(int[][] M) { if (M == null || M.length == 0) return new int[0][0]; int x=M.length; int y=M[0].length; int [][] result=new int[x][y]; int [][] dir ={{0,0},{0,1},{1,0},{1,1},{0,-1},{-1,0},{-1,-1},{-1,1},{1,-1}}; for(int i=0;i<x;i++){ for(int j=0;j<y;j++){ int sum=0,count=0; for(int[] k:dir){ if(i+k[0]>=0 && i+k[0]<x && j+k[1]>=0 && j+k[1]<y){ sum+=M[i+k[0]][j+k[1]]; count++; } result[i][j]=sum/count; } } } return result; }}
阅读全文
0 0
- Leetcode 661 Image Smoother
- leetcode 661 Image Smoother
- LeetCode 661 : Image Smoother(python)
- LeetCode-661:Image Smoother (灰度图像平滑)
- 【LeetCode】661. Image Smoother
- LeetCode 661. Image Smoother
- leetcode 661. Image Smoother
- leetcode 661. Image Smoother
- LeetCode 661. Image Smoother
- leetCode-Image Smoother
- LeetCode-661. Image Smoother
- 【LeetCode】661. Image Smoother
- leetcode 661. Image Smoother
- 661 Image Smoother
- leetcode[Image Smoother]//待整理多种解法
- 661. Image Smoother
- 661. Image Smoother(Java)
- 661. Image Smoother
- 视频物体分割--One-Shot Video Object Segmentation 2017年cvpr
- 数据结构(C语言)线性表 顺序存储
- 【转】数据库基本知识:(七)函数和表达式的使用
- 随机森林 Random Forest
- Navicat premium连接Oracle中遇到的一些问题
- leetcode 661 Image Smoother
- android:代码中动态添加子布局
- eclipse 常用的快捷键
- git远程仓库提交的撤销以及git reset的几种用法
- windows下生成github ssh key详解
- 10月10日云栖精选夜读:阿里云Tech Insight 企业迁云实战专场强势来袭!
- Android系统增加电话通道音量条
- [境内法规]人行、银监会、证监会、保监会令〔2007〕第 2号—金融机构客户身份识别和客户身份资料及交易记录保存管理办法
- 【面试】触发器