[Hackerrank]Max min sum(排序) 技术标签: 简单题意: 给定一个数组,要求去掉一个元素,求剩余元素中最大值与最小值的差值。 思路: 排序 两种选择:去掉原数组最小的值或者是最大的值。 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <queue>...
Greedy Algorithmsare algorithms that make locally optimal choices at each step in the hope of eventually reaching the globally optimal solution Problems must exhibit two properties in order to implement a Greedy solution: Optimal Substructure An optimal solution to the problem contains optimal solutions ...