We can improve the time complexity of some solutions from quadratic to linear using the two-pointer approach

Two-Pointer Approach

To solve problems like Two Sums, Product Except Self, or Contains Duplicate we have to access multiple values at the same time from a sequential data structure (for example, a Linked List or an Array). The initial instinct while solving these problems is to use nested loops where each layer of the loop will maintain a different iterator on the data structure. But this approach does not scale well with the size of input as a single order of nested loops has $O(n^2)$ worst-case time complexity....

January 23, 2024 · 7 min · Avnish

Go Programming Language

Go is a compiled language developed by Robert Griesemer, Rob Pike, and Ken Thompson at Google. It is primarily used in cloud-native and web development projects. Some of the popular projects created with Go Docker: Container Engine Kubernetes: Container Orchestrator Hugo: Static Site Generator (Also used to generate this blog) Helm: Package manager for Kubernetes Packages A Package abstraction is created in Go to group functions that are related to each other or associated with a specific task....

June 21, 2023 · 17 min · Avnish