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

0% completed

Vote For New Content
Avanish Vyas
Feedback to add a general template for all coding patterns

Avanish Vyas

Oct 20, 2024

It would be great if you could add a general template for each coding pattern that we can re-use in all the problems of that type. Also, it would be better

0

0

Comments
Comments
Avanish Vyas
Avanish Vyasa year ago

For e.g. the general coding template (GCT) for binary search is:


def binary_search(array) -> int:
    def condition(value) -> bool:
        pass

    left, right = 0, len(array)
    while left <= right:
        mid = left + (right - left) // 2
        if conditi...

On this page

Backtracking

An Example