class Solution(object):
def maxIncreaseKeepingSkyline(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
import numpy as np
grid=np.array(grid)
ori=grid.sum()
for i, _ in enumerate(grid):
for j, _ in enumerate(grid[i]):
grid[i][j] = min(max(grid[i]), max(grid[:,j]))
print(grid)
ans=0
for i,_ in enumerate(grid):
ans+=sum(grid[i])
return ans-ori

Leetcode 807. Max Increase to Keep City Skyline的更多相关文章

  1. Leetcode 807 Max Increase to Keep City Skyline 不变天际线

    Max Increase to Keep City Skyline In a 2 dimensional array grid, each value grid[i][j] represents th ...

  2. LeetCode #807. Max Increase to Keep City Skyline 保持城市天际线

    https://leetcode-cn.com/problems/max-increase-to-keep-city-skyline/ 执行用时 : 3 ms, 在Max Increase to Ke ...

  3. LC 807. Max Increase to Keep City Skyline

    In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located the ...

  4. 【LeetCode】807. Max Increase to Keep City Skyline 解题报告(Python &C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  5. [LeetCode&Python] Problem 807. Max Increase to Keep City Skyline

    In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located the ...

  6. 【Leetcode】807. Max Increase to Keep City Skyline

    Description In a 2 dimensional array grid, each value grid[i][j] represents the height of a building ...

  7. [LeetCode] Max Increase to Keep City Skyline 保持城市天际线的最大增高

    In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located the ...

  8. [Swift]LeetCode807. 保持城市天际线 | Max Increase to Keep City Skyline

    In a 2 dimensional array grid, each value grid[i][j]represents the height of a building located ther ...

  9. BZOJ1628: [Usaco2007 Demo]City skyline

    1628: [Usaco2007 Demo]City skyline Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 256  Solved: 210[Su ...

随机推荐

  1. bootstrap圆角

    圆角问题 这里为圆角, .;}   原因是我是用li 标签的line-height给他撑开的,所以会出现圆角,所以我没有定义side的background-color加上就好了             ...

  2. java队列的实现

    队列也可以通过数组和链表两种方式来实现. 1.链表方式实现 class Node{ Node next = null; int data; public Node(int data){this.dat ...

  3. 112. Path Sum (判断路径和是否等于某值)

      Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up a ...

  4. 牛客网暑期ACM多校训练营(第一场)- J Different Integers (莫队)

    题意:裸的莫队题,每个查询Li,Ri,返回区间[1,Li]和[Ri,N]区间中不同的数的个数. 分析:正常的离线查询,是求区间[Li,Ri]中要求的答案,而该题所求答案为外侧两个区间中的答案,那么cn ...

  5. VMWare 网络连接模式(bridged、NAT、host-only)详解

    转自VMWare 网络连接模式(bridged.NAT.host-only)详解 host-only 在某些特殊的网络调试环境中,如何要求将真实环境和虚拟环境隔离开,这时你就可采用host-only模 ...

  6. [转]浅谈Hive vs. HBase 区别在哪里

    浅谈Hive vs. HBase 区别在哪里 导读:Apache Hive是一个构建于Hadoop(分布式系统基础架构)顶层的数据仓库,Apache HBase是运行于HDFS顶层的NoSQL(=No ...

  7. 【Head First Servlets and JSP】笔记23:Expression Language(EL) 完全攻略

    基本上是<Head First Servlets and JSP>内容的整理.扩充.顺便推荐一个供参考的JSP教程:JSP Tutorial内容很全面,还有一些有趣的实例. 完整代码参考 ...

  8. tesseract编译各种 “锟斤拷” 等中文乱码 编译失败问题

    编译tesseract - ocr时 各种不通过 也很疑惑,完全按照官方指导来的啊 首先以为是vs的编码问题,随切换选项-切换Unicode或多编码字符集,但仍无效. 定位到乱码的文件,用notepa ...

  9. OCR训练数据生成方法

    有的时候我们训练网络的时候,数据集在收集的过程中由于种种原因导致图像收集的不完整,比如某些种类很少,或者没有,这个时候我们就可以考虑自己生成数据集. 这个和data augmentation还不太一样 ...

  10. windchill相关功能操作

    1.创建产品   2.创建文件夹   3.创建文档   4.创建用户账号   5.创建组   6.创建更改请求   7.创建部件新视图版本   8.创建可重用属性和全局枚举   9.在组织内分配上下文 ...