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.
ur method uses recursion and is definitely at least O(n^2), i cant be bothered to figure out the exact time of this recursion, but note that the brute force method is O(n^2).
furthermore, there are issues with ur possible_ans, ur creating a local storage in each call stack, not a global storage and passing it by reference during recursion.
the question wants O(n)
if u had no time out its because the test cases are weak
look at my method, its O(n)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Largest Rectangle
You are viewing a single comment's thread. Return to all comments →
ur method uses recursion and is definitely at least O(n^2), i cant be bothered to figure out the exact time of this recursion, but note that the brute force method is O(n^2).
furthermore, there are issues with ur possible_ans, ur creating a local storage in each call stack, not a global storage and passing it by reference during recursion.
the question wants O(n)
if u had no time out its because the test cases are weak
look at my method, its O(n)