Code Monkey home page Code Monkey logo

Comments (13)

stevem99 avatar stevem99 commented on August 16, 2024 1

Okay- after tracing the steps it was a problem with my method of finding the least common denominator for my end result fractions! WHEW
[4, 5, 5, 4, 2, 20]

from google-foobar-help.

stevem99 avatar stevem99 commented on August 16, 2024

Okay- I've got mine to the same point as another guy, it is only failing test 6. Not sure what edge cases I could look out for!

from google-foobar-help.

ivanseed avatar ivanseed commented on August 16, 2024

Hey,

Which problem is this? doomsday_fuel?

Also you should be able to do if (input > x) { return null; } and if you still have the same tests failing you can then do if (input > x) { System.out.println; } then if you get an error you found out some information about your inputs.

from google-foobar-help.

stevem99 avatar stevem99 commented on August 16, 2024

I really appreciate your help. After putting this in I saw some of the conversation with others in the closed issues. This input method looks like a java example, do you know if it works in Python ?

Thanks again.

from google-foobar-help.

ivanseed avatar ivanseed commented on August 16, 2024

You will want to throw some conditionals against the argument that you are taking from each test. So for example you are being passed a map m.

If you write if len(m) > 4 and return null inside the conditional you will fail all tests which the input was greater than 4 in length. Now lets say you find out by the process of elimination that all your tests pass except number 6 when you write if len(m) == 1 - you still do not know with 100% certainty that the conditional is passing.

However you can replace the return null with print('foo') which will cause ANY tests that HIT this line to throw an error. If you get an error, you have found some information about the input that is causing you trouble. If you do not get an error, then that input is not being used by any tests.

You may find that the test you are failing is an edge case, where the map is [1] or [[1,0],[0,1]].

from google-foobar-help.

stevem99 avatar stevem99 commented on August 16, 2024

Okay- thanks! That makes sense. I have sort of been doing that but I thought you had a better trick.

I did catch the m=[[1]] issue, and I do have a check in there for a 2x2 matrix (but it never fires). I will continue trying to poke for more information about the test case, and maybe review some more of my logic. I went from not knowing much about matrices to feeling like an expert- okay maybe not but I know a lot more than I ever did :) I was reading the scipy and numpy are really the best way to work with matrices in python but we have to do it by hand in foobar.

I will keep at it, wish me luck, I only have approx 1 day remaining.

from google-foobar-help.

ivanseed avatar ivanseed commented on August 16, 2024

Best of luck!

Maybe it could be a fraction that is not being simplified as much as possible, or something is slightly wrong with multiplication/addition.

from google-foobar-help.

stevem99 avatar stevem99 commented on August 16, 2024

I was able to identify the problem matrix, I'm tracing thru my code to see if there is some bug..
[[0, 7, 0, 17, 0, 1, 0, 5, 0, 2],
[0, 0, 29, 0, 28, 0, 3, 0, 16, 0],
[0, 3, 0, 0, 0, 1, 0, 0, 0, 0],
[48, 0, 3, 0, 0, 0, 17, 0, 0, 0],
[0, 6, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

**WARN- Answer looks wrong :( [2, 2, 2, 2, 1, 10]

from google-foobar-help.

ivanseed avatar ivanseed commented on August 16, 2024

I think I ran into a problem with my LCM method too. Glad you figured it out though I can imagine it was very long winded.

from google-foobar-help.

sreetamdas avatar sreetamdas commented on August 16, 2024

Hey @stevem99 , how were you able to get the matrix which was failing the test case?

I'm on this challenge myself.

from google-foobar-help.

stevem99 avatar stevem99 commented on August 16, 2024

I used ivanseed method of intentionally setting up an error condition, except I combined it with a mapping of each value to a specific exception so I would know what value was being supplied to the program based on the raised exception. It was kind of a brute-force style attack but I was desperate and it does work.

from google-foobar-help.

ivanseed avatar ivanseed commented on August 16, 2024

I think it would be fair if they allowed to reveal one of the tests per challenge, i.e. if you are failing only 6 and have not used your reveal you could see the inputs just for that test.

from google-foobar-help.

sreetamdas avatar sreetamdas commented on August 16, 2024

True, as is the system in Hackerrank, wherein you can trade in your "Hackos" to see test cases

from google-foobar-help.

Related Issues (18)

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.