Yahoo India Web Search

Search results

  1. Jun 26, 2023 · The idea is to increase the first i towers by k and decrease the rest tower by k after sorting the heights, then calculate the maximum height difference. This can be achieved using sorting. Illustration: Given arr [] = {1, 15, 10}, n = 3, k = 6. Array after sorting => arr [] = {1, 10, 15} At i = 1.

  2. Smallest Range II - You are given an integer array nums and an integer k. For each index i where 0 <= i < nums.length, change nums [i] to be either nums [i] + k or nums [i] - k. The score of nums is the difference between the maximum and minimum elements in nums.

  3. Given an array arr[]&nbsp;denoting heights of N towers and a positive integer K, you have to modify the height&nbsp;of each&nbsp;tower either by increasing or decreasing them by K only once. . Find out what could be the possible&nbsp;minimum differenc.

  4. leetcode.com › problems › minimum-difference-between- LeetCode

    Can you solve this real interview question? - Level up your coding skills and quickly land a job.

  5. Height Checker - A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height.

  6. Jun 14, 2024 · A coding problem and solution to minimize the difference between the heights of towers after modifying them by a fixed value. The article explains the approach, code and complexity of the algorithm.

  7. People also ask

  8. Given an array arr[] denoting heights of N towers and a positive integer K. For each tower, you must perform exactly one of the following operations exactly once. Increase the height of the tower by K Decrease the height of the tower by K Fin