203
来源:互联网 发布:mac端口号查询 编辑:程序博客网 时间:2024/06/06 02:48
2017.9.8
总感觉自己的方法太暴力。
/** * Definition of SegmentTreeNode: * public class SegmentTreeNode { * public int start, end, max; * public SegmentTreeNode left, right; * public SegmentTreeNode(int start, int end, int max) { * this.start = start; * this.end = end; * this.max = max * this.left = this.right = null; * } * } */public class Solution { /* * @param root: The root of segment tree. * @param index: index. * @param value: value * @return: */ public void modify(SegmentTreeNode root, int index, int value) { // write your code hereif(root == null){return;}if(index < root.start || index > root.end){return;}if(root.start == root.end && root.end == index){root.max = value;}else{modify(root.left, index, value);modify(root.right, index, value);root.max = Math.max(root.left.max, root.right.max);} }}
阅读全文
0 0
- 203
- 203
- cf 203
- sgu 203
- HDOJ-203
- ocp-203
- 203,状态栏
- stnemelEtsiLdekniLevomeR.203
- LEETCODE 203
- leetcode237&203
- NYOJ-203
- BUPT 203 Palindrome
- codeforces 203E Transportation
- NYOJ 203-三国志
- 203计算机毕业设计
- 203室:凶宅
- NTAG 203结构
- Windows系统错误203
- java核心技术卷 之JFrame
- 修改UIWebView中字体的大小
- git操作文档
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- 面试总结
- 203
- HandlerThread实现数字时钟
- String的常用方法
- Codeforces 190D Non-Secret Cypher【思维+RMQ+二分】
- BillPrint
- 静态工厂方法
- 道格拉斯-普克算法(Douglas–Peucker algorithm)---多边形逼近算法
- 高级算法日记10:图(3)
- 西子湖畔