牛客网2016校招真题在线编程之最大差值
2017-11-26 02:28
323 查看
直接暴力搜即可。
AC代码:
import java.util.*; public class LongestDistance { public int getDis(int[] A, int n) { int res = Integer.MIN_VALUE; for(int i=0; i<A.length-1; i++){ for(int j=i+1; j<A.length; j++){ res = Math.max(A[j]-A[i], res); } } return res; } }
相关文章推荐
- 牛客网2016校招真题在线编程之懂二进制
- 【校招真题】2016 美团 最大差值
- 【newCoder】2016校招真题在线编程 小米Git
- 2016校招真题在线编程 懂二进制
- 【newCoder】2016校招真题在线编程 风口的猪-中国牛市
- 最大差值(美团校招真题)
- 2017校招真题在线编程之素对数
- 【newCoder】2016校招真题在线编程 二分查找
- 2017校招真题在线编程 异或
- 【真题】拼多多2018校招内推编程题 最大乘积
- 2016校招真题之最大差值
- 2017校招真题在线编程
- 美团在线编程2016--最大差值
- 【newCoder】2016校招真题在线编程 懂二进制
- 最大差值----美团2016研发工程师在线编程题
- 2017校招真题编程训练--求数列的和
- 【真题】京东2017校招编程题 幸运数
- 南邮编程在线编程题十一:指针形参的使用,找数组中的最大最小元素值
- 微软2014实习生及校招秋令营技术类职位,在线编程题目及解答。
- 【面试题-编程】查找数组中差值最大的两个数