Code Monkey home page Code Monkey logo

Comments (4)

akj2018 avatar akj2018 commented on June 17, 2024

Hi @mr-robot77, can you also specific which algorithm is giving wrong output along with

  • inputs
  • expected output
  • incorrect output.

from courses-project.

mr-robot77 avatar mr-robot77 commented on June 17, 2024

in the python ch2 string folder
returner program has an issue in runtime output
this program is about a safe with k rotating locks with a sequence of numbers from 1 to 9 and our mission is finding to k-digit code from input and in the output should give the minimum number of rotation of the wheels for the number to be equal to the code.
if we get this input:
3 123 241356789 987546231 956874231
our expected output should be this:
7
but because of something is missing in define of algorithm of this problem, so we get this wrong output:
2148921431256

from courses-project.

akj2018 avatar akj2018 commented on June 17, 2024

Hey,

  1. I not able to understand what you are trying to achieve
  2. The code implies that locks is a list of sub lists but the input provided is unclear about how many elements goes in each iteration
    Eg.

k = 3
code = 123

for k = 1
input can be 241356789
OR
input can be 241356789 987546231
OR
input can be 241356789 987546231 956874231

Therefore, please provide an input separated by new line

  1. if number in locks[i]: will always result in False since it's checking if 1 is an element in a sub list and this is never the case
    Therefore, my answer in always 0

from courses-project.

mr-robot77 avatar mr-robot77 commented on June 17, 2024

i solved the issues and change the code
now it's worked correctly

from courses-project.

Related Issues (2)

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.