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

0% completed

Vote For New Content

is this a mistake? The Output should be zero, as there is not any triplet which can add to 100,

mananpat

May 10, 2025

0

13

0

May 10, 2025

Question on abs(targetDiff) logic

V F

Dec 2, 2024

0

35

0

Dec 2, 2024

My Python solution. Similar to solution but different in terms of readability

Eric Imho Jang

Jul 26, 2024

4

57

1

Aug 10, 2025

My solution

Anonymoussealess

Mar 7, 2024

0

31

0

Mar 7, 2024

Wrong result for example 4 in visualization

Bruno Ely

Jan 15, 2024

2

43

0

Feb 18, 2024

I feel just keeping up with the sum rather than calculating the difference right away makes things easier to read and comprehend when updating smallest_diff

Landon Brown

Jan 14, 2024

4

66

1

Jan 7, 2025

Wrong value for smallest some in the example visualization.

Landon Brown

Jan 13, 2024

0

24

0

Jan 13, 2024

Js solution needs some corrections

Daniil

Dec 18, 2023

0

26

1

Dec 22, 2023

Missing C# Solution

Travis

Nov 12, 2023

0

7

1

Jan 4, 2024

Example 1 explanation is incorrect

himanshu1495

Oct 30, 2023

0

36

0

Oct 30, 2023

Variables' names

Abdullah AlKheshen

Oct 27, 2023

0

8

0

Oct 27, 2023

Explanation is talking about Java?

Aaron Kashab

Sep 5, 2023

0

47

0

Sep 5, 2023

Problem with Test case 4

Derrick Duah

May 7, 2023

0

52

1

May 7, 2023

Why is there no test cases ?

Vijay Singh

Apr 30, 2023

0

13

0

Apr 30, 2023

As a side note for this question as well. arr.length - 2 in the initial for loop...

CaptainKidd

Jan 18, 2023

1

30

0

Jul 18, 2023

Any feedback for this solution?

Anthony DiFede

Nov 27, 2022

3

77

2

Feb 11, 2024

Given that MDN says that the sort method on the Array prototype is in place, wou...

Edu

Mar 21, 2022

0

17

4

Apr 26, 2022

What is the point of " i < arr.length - 2" in the JS solution? I've been writing...

Ada

Feb 21, 2022

0

15

2

Feb 21, 2022

On line 19 of Python solution, why is it overriding smallest_difference if the n...

hj3yoo

Feb 21, 2022

4

66

1

Dec 15, 2024

Can you please help me in explaining the if condition '(Math.abs(targetDiff) == ...

Abhinav Gupta

Jan 28, 2022

0

62

3

Jun 27, 2023

There is some redundancy in the solution.Referring to JS:` if (target_diff === 0...

seth

Jan 8, 2022

0

12

1

Jan 9, 2022

// the second part of the following 'if' is to handle the smallest sum when we ...

Learner

Jan 7, 2022

3

53

6

Feb 22, 2024

On this page

Problem Statement

Try it yourself