As the name implies, a greedy technique always chooses the option that appears to be the best at the time. This means it will make a locally optimal decision to arrive at a globally optimal solution.
For example, if you want to travel from point A to point B, there are numerous options, such as walking, cycling, car, air, etc.
However, if you need to arrive in the shortest amount of time, you'll estimate the time from all possible options and then choose wisely which will be the most efficient. You must compare the current option with the previous option to select the optimal solution. This is referred to as the greedy technique.
In computer science, we frequently employ greedy techniques. This category revolves around greedy techniques and uses them in solving optimization problems.