Code Monkey home page Code Monkey logo

algorithms's Introduction

Algorithms

Solving algorithms tasks.

LeetCode

Easy

Jewels and Stones

Time: 31 ms,

Faster than 2.57% of Java online submissions.

We use split string S and J into arrays. After we create a hashmap of S, where a key is a letter and value number of this letters in S. The last step is to find what letters from J exist in this hashmap and sum values.

Unique Email Adresses

Time: 72 ms,

Faster than 22.96% of Java online submissions.

Firstly we check that emails are correct (1 <= emails.length() <= 100; 1 <= emails[i] <= 100; every email contains only 1 @ symbol. Secondly, we split email by "@", and remove all after "+". After we remove dots.

Create a new set, save emails and get size of this set.

Two Sum

Time: 400 ms,

Faster than 42.19% of C# online submissions for Two Sum.

Memory Usage: 30.5 MB, less than 92.69% of C# online submissions for Two Sum.

There is an input array and an input target int values. Program should find 2 indices for which values sum is equal to target.

Starts from the first number, check if it sum with next value is equal to target; when array ends, start comparing for second number; and do it until there is end of the array.

algorithms's People

Contributors

irina-voropaeva 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.