Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Issue with "Bonfire: Pairwise". Test wrong?

See original GitHub issue

I was going to do this bonfire, and, after a time thinking about how to do it, I noticed this test:

``````expect(pairwise([0, 0, 0, 0, 1, 1], 1)).to.equal(10);
expected 1 to equal 10
``````

That’s arr[0] + arr[4] = 0+4 = 4 And arr[1] + arr[5] = 1 + 5 = 6 6 + 4 = 10

These are [0,1] pairs, repeated.

Well, the explanation of this bonfire says this:

Bla bla bla If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.

So, if you get the same pair, Only use the smallest sum of indexes, right? This test breaks this condition. With this, I don’t know if even I can trust in the exercise description. I don’t know if the exercise is wrong, if the description is misleading or if only the test is wrong, but something seems to be wrong.

### Issue Analytics

• State:
• Created 8 years ago

1reaction
richchurchercommented, Sep 20, 2015

@soulchainer I’ve often thought this exercise and its description caused more confusion than it was worth.

I believe the test is ok, though. It only says once an element has been used it can’t be re-used… it doesn’t say, once an integer has been used. It also asks for the sum of all indices that can be paired. The test provides multiple elements with the same value for the purpose of checking if the provided solution can detect the lowest possible combination. Possible answers include:

``````[0, 0, 0, 0, 1, 1]
Indices: 0 + 4, 1 + 5 = 10
Indices: 1 + 4, 2 + 5 = 12
Indices: 2 + 4, 3 + 5 = 14
``````

So the test is required to ensure that the solution has correctly picked the lowest sum.

0reactions
diogogomeswwwcommented, Jan 1, 2017

I don’t understand. The problem clearly says `If multiple pairs are possible that have the same numeric elements but different indexes, return the smallest sum of indexes.`

So for test case: `[0, 0, 0, 0, 1, 1] Indexes: [0,4], [1,5] Values: [0,1],[0,1]`

The indexes 1+5 should be not included, hence the answer should be 0+4 = 4, right?

#### Top Results From Across the Web

Bonferroni correction - Wikipedia
In statistics, the Bonferroni correction is a method to counteract the multiple comparisons problem. ... Of note, the Bonferroni correction controls for family-wise...
Previous render sometimes leaking into next test #716 - GitHub
I'm running into the same issue that the previous render leaks into the next test. Sounds to me like a very bad thing...
Types of Errors in Hypothesis Testing - Statistics By Jim
Learn about the two types of errors in statistical hypothesis testing, their causes, and how to manage them.
Do This When Your Fire Stick Remote Is Not Working - YouTube
https://www.smartdnsproxy.com - Get 14 Days free trial. - Smart DNS Proxy, VPN & SmartVPN services. 400+ Global streaming network access.
10 common issues with Amazon Fire TV stick and how to fix ...
To help you use the streaming device smoothly, here are 10 common issues with Fire TV devices and how you can resolve them....

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free