Git Product home page Git Product logo

Comments (4)

HuberTRoy avatar HuberTRoy commented on August 28, 2024

Thanks for test.
ListNode and TreeNode are defined in comments. LeetCode defined them in the background, if we defined them clearly then LeetCode will give an error.

l_r_m at Array/KthLargestElementInAnArray.py , b and c at /Array/SumOfSubarrayMinimums.py are my fault,

Thanks again.

xrange is just for Python 2, if you run it on Python 3 please use range instead of it.

range also can run on Python 2, it is a list on Python 2 rather than a generator.

from leetcode.

cclauss avatar cclauss commented on August 28, 2024

To support both Python 2 and Python 3 just put this at the top of xrange() files:

try:
    xrange          # Python 2
except NameError:
    xrange = range  # Python 3

from leetcode.

cclauss avatar cclauss commented on August 28, 2024

Inside the functions that use ListNode or TreeNode, you can put global ListNode or global TreeNode to acknowledge that these are created elsewhere.

from leetcode.

HuberTRoy avatar HuberTRoy commented on August 28, 2024

@cclauss
I think that is not necessary.

We can find definition information at the top of the files that use ListNode or TreeNode.

# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

They are just being commented to fit test of LeetCode.

from leetcode.

Related Issues (4)

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.