Giter VIP home page Giter VIP logo

assignment-dsa's Introduction

Instructions

Algorithms

  1. Sieve of Eratosthenes In mathematics, the sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit.

    A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.

    The algorithm consists of creating a list of consecutive integers from 2 through n (2 <= n <= 2^64) and marking them off as prime (or composite)

    Implement this algorithm in Javascript or TyeScript as a function sieveOfEratosthenes(n: number) that returns an array of all prime numbers up to (and including) n.

  2. Least Common Multiple In mathematics, the least common multiple (LCM) of two or more integers is the smallest positive integer that is divisible by each of the given integers.

    For example, the LCM of 4 and 6 is 12.

    Implement this algorithm in Javascript or TyeScript as a function leastCommonMultiple(n1: number, n2: number) that takes two integers returns the LCM of the given integers.

  3. Palindrome A palindrome is any string that can be reversed and still be the same. An example of one is 'radar', since it is spelled the same even after being reversed.

    Implement this algorithm in Javascript or TyeScript as a function palindrome(str: string) that takes a string and returns true if the string is a palindrome.

assignment-dsa's People

Contributors

wseng avatar

Watchers

Mary Maina 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.