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

0% completed

Vote For New Content

Simpler with nested for-loops?

tahriris

Dec 10, 2024

2

29

0

Mar 17, 2025

Much simpler solution with a classic moving left pointer up 1 and trying again

adi berkowitz

Dec 8, 2024

0

38

0

Dec 8, 2024

Two for loops O(N^2) solution

softest mike

Nov 27, 2024

0

29

1

Nov 27, 2024

Alternate JS solution still. Is my time/space complexity accurate?

Zachary Nelson

Oct 30, 2024

0

8

0

Jul 4, 2025

My solution with O(N^2) for both time and space complexity

Nabeel Keblawi

Oct 7, 2024

0

25

1

Jan 7, 2025

My python solution

Eric Imho Jang

Jul 26, 2024

0

37

0

Jul 26, 2024

Isn't that harder than medium?

lejafilip

Jul 10, 2024

0

56

0

Jul 10, 2024

This's a sliding window pattern not a two pointers one

Abdullah AlKheshen

Jun 26, 2024

5

57

0

Jan 8, 2025

This is a better O(N)^2 solution

Mohammed Dh Abbas

Jun 23, 2024

1

50

1

Nov 27, 2024

Why is the solution posted so confusing - I believe mine is simpler

adi berkowitz

Jun 5, 2024

0

66

0

Jun 5, 2024

Sub Array Creation Makes O(n) solution O(n^2)

himanshu1495

Nov 16, 2023

0

86

0

Nov 16, 2023

This problem has incorrect grading system

anhquan.tranle0601

Sep 24, 2023

0

84

0

Sep 24, 2023

[Spoiler] inserting elements into temp list

John O'Neill

Sep 13, 2023

2

90

2

Nov 7, 2024

(Spoilers) Why do we iterate from right to left?

Daven L

Sep 12, 2023

2

89

0

Aug 13, 2024

why does creating subarrays take O(N^2) time in the worst case?

samah

Sep 7, 2023

0

115

2

Sep 12, 2023

How come we take into account of output list for time complexity for this problem?

Tom

Aug 17, 2023

0

11

0

Aug 17, 2023

Why use list(temp_list) in Python answer

Frank

Jul 26, 2023

0

38

1

Aug 17, 2023

Why the while loop of dividing the product?

Gaurav Pachpande

Jul 20, 2023

0

31

1

Aug 1, 2023

Simpler O(n^2) solution (Java)?

Some Dude

Jul 18, 2023

2

63

2

Apr 8, 2024

Confusion on the Solution (Java)

Adrian Harischand

Jul 13, 2023

0

42

1

Jul 16, 2023

Easy Alternate Solution: From left to Right [Python]

k

Jul 7, 2023

1

81

2

Jul 9, 2023

Error running code

Ming Chen

Jun 29, 2023

0

11

0

Jun 29, 2023

Solution with different order of sub arrays not accepted

Ashwin Ramesh

Jun 23, 2023

2

24

1

Feb 25, 2024

Why the solutions complexity can't be just O(n)?

Amir Roshanaei

May 27, 2023

0

44

0

Aug 11, 2023

Start at the declaration of tempList and the following for loop, that is some ve...

Dario Avetisov

Feb 23, 2023

2

18

0

Aug 13, 2024

"product" not square so must be two numbers at least.

Smoke

Dec 13, 2022

1

18

0

Jul 16, 2023

Your solution explanation is pointless. What happened to pictures and a walk-thr...

stephen

Dec 5, 2022

19

127

3

Aug 13, 2024

Why do we use a deque here instead of a list?

Matt Lee

Sep 20, 2022

0

32

1

Sep 20, 2022

is this a sliding window pattern? I can't see how it is both sliding window and ...

Kiriyama Rei

Jul 22, 2022

0

52

3

Aug 31, 2022

Why just 2 indices? Subarrays can be of more elements, can't they?For an array w...

aj

Jun 28, 2022

1

21

1

Jun 28, 2022

In Subarrays with Product Less than a Target, I don't understand why you use a D...

agustin.vaca

Apr 28, 2022

0

26

2

Jun 22, 2022

in the while loopwhile (product >= target && left < arr.length)why is left boun...

Shannon Wang

Apr 25, 2022

4

40

1

Aug 17, 2024

Why is the creating subarrays up to O(N^2)? From what I can tell the inner loop ...

Egzon Bislimi

Feb 9, 2022

0

37

3

Aug 25, 2022

There is a simple O(N) solution using sliding window.

Andrew McMillan

Dec 30, 2021

1

110

4

Nov 17, 2022