Each cost function is written as a triple (b, a, c) standing for
b^{\,n} \cdot n^{a} \cdot (\log_2 n)^{c}
so (1, 2, 0) is n^2, (1, 1, 1) is n\log n, (1, 0, 0) is constant and (2, 0, 0) is 2^n.
Given a list terms of such triples, return the list of their indices, ordered from the slowest growing to the fastest. Two identical triples keep their original order.
Examples
Input: terms = [(1, 2, 0), (1, 1, 1), (2, 0, 0), (1, 0, 0)]
Output: [3, 1, 0, 2]
Explanation: 1, then n log n, then n^2, then 2^n.
Input: terms = [(1, 0, 1), (1, 0, 2)]
Output: [0, 1]
Explanation: log n grows more slowly than (log n)^2.
Constraints
0 <= len(terms) <= 20001 <= b <= 10,0 <= a <= 10,0 <= c <= 10
Goals
- Order functions by how fast they grow, not by how large they are at n = 10
- Know that an exponential beats every power, and a power beats every logarithm
- Ignore constant factors when comparing growth