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.
Array Manipulation
Array Manipulation
Sort by
recency
|
2418 Discussions
|
Please Login in order to post a comment
timeout error ....
Python / Prefix Sum / Sparse Array
The question is not framed correctly and hence the problem is not easy to comrehend. if this is better framed, a lot of attmpts will be made to solve this challenge.
Is there a problem with inputs? Because even I don't fill the function it goes segmentation fault when I submitted to code.
Program terminated with signal SIGSEGV, Segmentation fault.
0 main () at Solution.c:71
71 int queries_item = parse_int(*(queries_item_temp + j));
Did anyone solve this using Java? I am using Java 15, but get time-outs. I used the algorithm in the comment from @sswagat12, so my run-time complexity should be O(n+m). The only reasons I can think of why it is too slow is either Java being too slow (Garbage collector?) or because the provided String-parsing is too slow (Though I am not an expert on that one). Here's my code-snippet: public static long arrayManipulation(int n, List> queries) { // Write your code here long[] intArr = new long[n + 1];