Skip to main content

73 docs tagged with "greedy"

View all tags

Assign Cookies

This is a solution to the Assign Cookies problem on LeetCode.

Candy

This is a solution to the Candy problem on LeetCode.

Container With Most Water (LeetCode)

Given n non-negative integers representing the heights of vertical lines, find the two lines that together with the x-axis form a container, such that the container contains the most water.

Jump Game

You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position.

Jump Game II(LeetCode)

You are given a 0-indexed array of integers nums of length `n`. Return the minimum number of jumps to reach `nums[n - 1]`.

Largest Number(LeetCode)

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

maximum number of potholes that can be fixed

The given Solution class uses a greedy approach to maximize the number of potholes repaired within the given budget by prioritizing the repair of larger contiguous pothole segments first.

Minimum Elements to Add to Form a Given Sum

Solve the problem of finding the minimum number of elements to add to an array to make the sum equal to a given goal while maintaining the property that absolute value of elements does not exceed a specified limit.

Minimum number of jumps

find the minimum number of jumps required to reach the end of an array, given that each element represents the maximum length of the jump that can be made from that position.

Patching Array

This document provides solutions for the Patching Array problem.

Task Scheduler

This is a solution to the Task Scheduler problem on LeetCode.

Teemo Attacking

This is a solution to the Teemo Attacking problem on LeetCode.

Wiggle Sort II

This is a solution to the Wiggle Sort II problem on LeetCode.