Git Product home page Git Product logo

go-algorithms's Introduction

go-algorithms

This is a collection of algorithms and data-structure implemenetations in Go and Python made by myself!

How this works

I work with a TDD methodology. Each folder has its [name].go file and its [name]_test.go file. In order to run the go code just go to the desired path and run the following command:

go test [-v] // The -v flag is optional

Data Structures

Algorithms

Neet-Code 150

Arrays & Hashing

Two Pointers

  • Valid Palindrome (Leetcode 125): O(N) efficient solution, working with Go strings, runes or bytes is always a pleasure for its standard lib! Faster than 100% ⭐.
  • Two Sum II (Leetcode 167): O(N^2) brute force solution and O(N) efficient solution, because the array is sorted we don't need the hashmap approach.
  • 3Sum (Leetcode 15): O(N^3) brute force solution and O(N^2) Better approach in which we avoid duplicates by sorting the array and not using as first value (i) twice the same value. Then we reduce the rest of the two nums to a two sum problem.
  • Container With Most Water (Leetcode 11): O(N) time. It's not a hard problem it just requires problem specification.
  • Trapping Rain Water (Leetcode 42): O(NlogN) Approach based on finding local max "valleys", minimum of 3 numbers where the extremas are bigger than the inner numbers.

Sliding Window

Stack

Binary Search

Other

go-algorithms's People

Contributors

ggcr avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.