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
- Search
- Absolute Element Sums
- Discussions
Absolute Element Sums
Absolute Element Sums
Sort by
recency
|
65 Discussions
|
Please Login in order to post a comment
For C++ vector playingWithNumbers(vector arr, vector queries) { would not work because of arithmetic overflow, rather use: vector playingWithNumbers(vector arr, vector queries) {
JavaScript solution
I finally beated the hack. The key here is to note that, according to restrictions, there can be only 4001 different values for input, so we can characterize them by their value, and the number of occurrences for each. Then, it's pretty straightforward.
I am getting time limit exceeded on the 5th test, with C++20. But it runs on my laptop in 0.329s ... Any idea what's going on?
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Absolute Element Sums Solution