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.
your complexity will be of O(n1*n2+n1*n3), where n1 is the length of the smallest array
so after making the prefix array merge them end to end
and then apply sorting
thus your complexity will reduce to O(nlogn).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
your complexity will be of O(n1*n2+n1*n3), where n1 is the length of the smallest array so after making the prefix array merge them end to end and then apply sorting thus your complexity will reduce to O(nlogn).