Problem Statement | |||||||||||||
You are testing several algorithms and you want to find the fastest one for your task. Computational complexities of these algorithms will be given to you in three int[]s - constant, power and logPower. The ith algorithm needs on average constant[i]*Npower[i]*lnlogPower[i](N) operations to solve your task.
Given an int N, the size of your task, return the 0-based index of the fastest algorithm. In case of a tie, return the smallest index. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | ln(x) in the formula means natural logarithm of x. It can be computed as: - Math.log(x) in java - log(x) in C++ - Math.Log(x) in C# and VB. | ||||||||||||
Constraints | |||||||||||||
- | constant, power and logPower will have the same number of elements. | ||||||||||||
- | constant, power and logPower will each have between 1 and 50 elements, inclusive. | ||||||||||||
- | N will be between 1 and 1000, inclusive. | ||||||||||||
- | All elements of power and logPower will be between 0 and 5, inclusive. | ||||||||||||
- | All elements of constant will be between 1 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|