We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Greedy
- Sherlock and MiniMax
- Discussions
Sherlock and MiniMax
Sherlock and MiniMax
Sort by
recency
|
154 Discussions
|
Please Login in order to post a comment
Python O(n) solution where n is size of array.
Hi, in Java, I always get: "Time limit exceeded Your code did not execute within the time limits. Please optimize your code."
for test case 8, 9 and 10. If I run the test locally with the test data from 8, 9 and 10, it runs perfectly. I have done some optimisation (e.g. convert list to array), but cant see how to optimise further. Here is my code: public static int sherlockAndMinimax(List arr, int p, int q) { int M; int maxMin = Integer.MIN_VALUE; int maxMinPos = 0;
easy tedious question, O(n) where n is size of arr