Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Problem with Test case 4

Derrick Duah

May 7, 2023

isn't the return value suppose to be 6 instead of 4?

0

0

Comments
Comments
Arslan Ahmad
Arslan Ahmad2 years ago

The correct answer is '4'. Please see the details under 'Explanation':

Explanation: There are two triplets with distance '1' from target: [1, 1, 2] & [0,0, 6]. Between these two triplets, the correct answer will be [1, 1, 2] as it has a sum '4' which is less than the...

On this page

Problem Statement

Solution

Algorithm Walkthrough

Code

Complexity Analysis

Time Complexity

Space Complexity