Tag: greedy
Jump Game - Greedy approach
Date: 2/23/2024Tags:algorithmsleetcodegreedyThis document explores a greedy approach to the Jump Game problem, discussing methods both from the end towards the beginning and from the beginning forward, emphasizing the efficient selection of nodes to jump to based on the maximum potential range each element provides, accompanied by a JavaScript function implementing this approach.
Non-overlapping intervals - 2nd attempt
Date: 2/11/2024Tags:algorithmsleetcodegreedyThe journal entry discusses improvements made to the solution for the non-overlapping intervals problem. The code sorts the intervals array by end points and uses two pointers to track non-intersecting intervals, maximizing space for more intervals.
Non-overlapping Intervals
Date: 2/10/2024Tags:algorithmsleetcodegreedyThis journal entry presents a greedy algorithm for finding non-overlapping intervals, where the intervals are sorted by their starting points and compared to determine the interval with the earlier end point, maximizing the remaining "space" to accommodate more intervals, with the provided code implementing the algorithm in JavaScript.
Minimum Number of Keypresses - 2nd attempt
Date: 2/10/2024Tags:algorithmsleetcodegreedyThe journal entry discusses a revised algorithm for determining the minimum number of keypresses required for a given string, with a conditional check for strings shorter than 9 characters and a strategy to minimize keypresses for characters with higher frequencies, demonstrated through a code snippet in JavaScript.
Minimum Number of Keypresses
Date: 2/9/2024Tags:algorithmsleetcodegreedyThis journal entry discusses the problem of finding the optimal keyboard configuration for a given string, where characters with the greatest occurrences require the fewest keypresses. The provided code is a function that calculates the minimum number of keypresses needed for a given string.