snippets 0.1.0
Loading...
Searching...
No Matches
monotonic_stack.hpp File Reference
#include <iostream>
#include <stack>
#include <functional>
#include <optional>
#include <vector>
Include dependency graph for monotonic_stack.hpp:

Go to the source code of this file.

Classes

class  hsc_snippets::MonotonicStack< T, Comparator >
 

Namespaces

namespace  hsc_snippets
 

Typedefs

template<typename T >
using hsc_snippets::MonotonicDecreasingStack = MonotonicStack<T, std::less_equal<T>>
 
template<typename T >
using hsc_snippets::MonotonicIncreasingStack = MonotonicStack<T, std::greater_equal<T>>
 

Functions

template<typename T >
std::vector< T > hsc_snippets::nextGreaterElement (const std::vector< T > &nums, std::function< T()> no_greater)
 
static int hsc_snippets::largestRectangleInHistogram (const std::vector< int > &heights)