0% completed
I need clarification on the problem statement.It states that " i, j, and k are t...
Eduardo Sánchez
Apr 4, 2022
I need clarification on the problem statement.
It states that " i, j, and k are three different indices." and not values.
For the first example when the list is already sorted : [ -1, 0, 2, 3 ] The combinations that fulfill the formula (arr[i] + arr[j] + arr[k] < target) are: Values: [ [ -1, 0, 3 ], [ 0, -1, 3 ], [ 2, -1, 0 ] ] indexes: [ [ x: 0, y: 1, z: 3 ], [ x: 1, y: 0, z: 3 ], [ x: 2, y: 0, z: 1 ] ]
I'm confused because the indexes are different, but definitely, we have a repeating triplet in a different order ( [ -1, 0, 3 ], [ 0, -1, 3 ],...
do you have any clarification on this? what am I misreading on the problem?
0
0
Comments
Eduardo Sánchez4 years ago
adding to the initial statement. "count all triplets "
Design Gurus4 years ago
[ -1, 0, 3 ] and [ 0, -1, 3 ] are the same since their values point to the same indices in the array. We are not asked to find the combinations of values, rather, we are limited by the use of three different indices. If two triplets point to the same indices, they shoul...
Eduardo Sánchez4 years ago
ah ok! So the valid answer is that the index triplets combination should be different! Gotchat
On this page
Problem Statement
Try it yourself