Giter Site home page Giter Site logo

sixty-rental's Introduction

Sixty Challenge

Rental Car Company Codility Challenge

Challenge One

Given two non empty Strings, A and B, consisting of N and M letters respectively Returns the minimum number of letters to add to the words specified in A and B to make them anagrams

Challenge Two

In an old drawer of your desk, you have found some long-forgotten necklaces. Each necklace comprises a number of beautiful, once shiny, beads. Unfortunately, now they are not only dusty, but also tangled together. You remember that the necklace with the most beads used to be your favorite.

Now, you are interested in finding the necklace with the largest number of beads, without having to untangle them all.

You have carefully photographed the necklaces and numbered all the beads with numbers in the range [0..Nโˆ’1], so that each number corresponds to exactly one bead. Then, for each bead, you have found the number of the next bead following it.

This information is given as an array of integers, indexed by bead numbers, and the elements are the numbers of the following beads. Each bead number appears in the array exactly once.

Write a function that: Given an array A consisting of N integers, as described above Returns returns the maximum number of beads in a single necklace. The function should return 0 if the array is empty.

For example, given array A such that: A[0] = 5 A[1] = 4 A[2] = 0 A[3] = 3 A[4] = 1 A[5] = 6 A[6] = 2

The function should return 4, because the longest necklace is the one containing four beads: {0, 5, 6, 2}

sixty-rental's People

Contributors

threenary avatar

Watchers

James Cloos 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.