Skip to main content

7 docs tagged with "Greedy"

View All Tags

Best Time To Buy And Sell Stock

You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Gas Station

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

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.

Largest Number

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

Task Scheduler

Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task.