GithubHelp home page GithubHelp logo

fullcrimp / dictionary-learner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sergeykovalchuk/dictionary-learner

0.0 2.0 0.0 7 KB

dictionary-learner task for code battle

License: MIT License

JavaScript 100.00%

dictionary-learner's Introduction

Dictionary-learner

Desctiption

You opened up a dictionary to a page in the "middle" and started flipping through, looking for words you didn't know. You just put each word that you didn't know at increasing indices in a huge list. When you reached the end of the dictionary, you started from the beginning and did the same thing until you reached the page that you started at.

Well. Right now you have a list of words that are mostly alphabetical, except they start somewhere in the "middle" of the alphabet, reach the end, and then start from the beginning of the alphabet. In other words, this is an alphabetically ordered list that has been "rotated".

TASK

Write a function for finding the index of the "rotation point", which is where I started working from the beginning of the dictionary. This list is huge (there are lots of words you don't know) so we want to be EFFICIENT here.

For example:

  words = [
    'ptolemaic',
    'retrograde',
    'supplant',
    'undulate',
    'xenoepist',
    'asymptote', # <-- rotates here!
    'babka',
    'banoffee',
    'engender',
    'karpatka',
    'othellolagkage',
]

findRotationPoint(words); // return 5

Write your code in src/index.js

Run test locally npm test

dictionary-learner's People

Contributors

fullcrimp avatar sergeykovalchuk avatar

Watchers

 avatar  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.