Code Monkey home page Code Monkey logo

contest-problems's Introduction

You might be surprised to know that 2013 is the first year since 1987 with distinct digits the years 2014 ,2015 ,2016, 2017 ,2018 2019 each have distinct digits. 2012 does not have distinct digits since the digit 2 is repeated Given a year what is the next year with distinct digits Write a function Named nextdistinct that receives one integer Y (0 ≤ Y ≤ 10000), representing the starting year and returns single integer D, which is the next year after Y with distinct digits.

BDD

2013 is the first year since 1987 with distinct digits Years 2014 ,2015 ,2016, 2017 ,2018 2019 each have distinct digits. 2012 does not have distinct digits since the digit 2 is repeated Writing a function Named nextdistinct that receives one integer Y (0 ≤ Y ≤ 10000)

Pseudocode

y = 3445

nums = [5,4,3]

345%10 = 5
345//10 =34

34%10 = 4
34//10 = 3

3%10 = 3
3//10 = 0

nums = [3,4,4,5]

return True if y has distinct digits return False if y does not have distinct digits

nextdistinct(1987) --> True nextdistinct(999) --> False

contest-problems's People

Contributors

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