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

0% completed

Vote For New Content
Any feedback for this solution?

Anthony DiFede

Nov 27, 2022

Any feedback for this solution?

Image

3

0

Comments
Comments
D
Derrick Duah2 years ago

I think this looks easier to understand than the solution provided

N
Nirbhay Lourembam2 years ago

There is a small correction as below. You need to add the || condition tripletSum < closestTripletSum

if (currentDistanceToTarget < smallestDistance || tripletSum < closestTripletSum) {

The solution in the image you provided does not work for the bel...

On this page

Problem Statement

Try it yourself