leetcode 1505. The smallest integer obtained after at most K exchanges of adjacent digits
给你一个字符串 num 和一个整数 k 。其中,num 表示一个很大的整数,字符串中的每个字符依次对应整数上的各个数位 。
你可以交换这个整数相邻数位的数字 最多 k 次。
请你返回你能得到的最小整数,并以字符串形式返回。
输入:num = "4321", k = 4
输出:"1342"
解释:4321 通过 4 次交换相邻数位得到最小整数的步骤如上图所示。
leetcode 1515. The best location of the service center
Give you an array of positions, where positions[i] = [xi, yi] represents the position of the i-th customer on the two-dimensional map. Please select a location for the service center. The coordinates of this position are [Xcentre, Ycentre],
returned to the Euclidean of all customers The smallest sum of distances.
Find N points on the map and find the distance between these N points and the smallest coordinate point. It can be seen that the objective function is a basin. If it is only a convex function, then three points at a time will do. If it is a basin, then To set three points, this is a very good three point practice.