Weird Problem

  • 0

    Hey guys; wondering if someone at leetcode code address why I'm getting different results in the debugger vs running the code through test cases.

    The code below returns 3 in the debugger yet returns 2 in when ran on this particular test case.

    see below.

    """class Solution:
    def distributeCandies(self, candies):
    candy_count = {}
    count = 0
    for i in candies:
    if i not in candy_count:
    candy_count[i] = 1
    for i in candy_count:
    if candy_count[i] ==1:
    return count
    s = Solution()

    Thanks for the help;also don't want to solution to the problem, just why the same platform is giving me two different results.

    Probelm:distributive candies

  • 1

    Hi, Leigham
    I think..
    This is why giving you two different results:

    Solution() works automatically without typing this in the LeetCode.
    That's why the value of 'return' shows.
    How about typing "return " and your wanted output at the bottom of the 'def distributeCandies~' without print()?
    Try again! Good luck!

  • 0

    @positive235 Thanks for the response, I've already ran the code without the bottom portion you've suggested using, none the less for the specific test case I've passed their are two different results. The test case when submitting the output ==2, when doing it in the debugging IDE output ==3. 3 is the right answer. So I'm at a loss as to whats going on. How do I directly contact the employees of the site ?

  • 0

    @positive235 actually never mind, I made a little error lol.

  • 1

    @Leigham Hmm..I don't know how to do it exactly, but the bottom of the homepage, there is "Contact Us". Click that text and "Other Inquiries".
    I think you can email to them!

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.