Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: AttributeError: 'NoneType' object has no attribute 'next'
Post: AttributeError: 'NoneType' object has no attribute...

The question is Given the head of a linked list, remove the nth node from the end of the list and return its head. My code: class ListNode: def __init__(self, val=0, next=None): self.val = ...
loves General Coding Help 2 11,650 Dec-15-2020, 08:56 PM
    Thread: Time Limit Exceeded error
Post: RE: Time Limit Exceeded error

(Dec-02-2020, 11:40 PM)deanhystad Wrote: One other thing. This is not important for this challenge because your solution will not have loops inside loops, but there is a better way to do the loopin...
loves General Coding Help 5 3,165 Dec-02-2020, 11:47 PM
    Thread: Time Limit Exceeded error
Post: Time Limit Exceeded error

I am going to solve leetcode problem. It passed some test cases but failed one case. It said Time Limit Exceeded class Solution: from typing import List def maxArea(self, height: List[int]) -...
loves General Coding Help 5 3,165 Dec-02-2020, 09:40 PM
    Thread: How to create a linked list and call it?
Post: RE: How to create a linked list and call it?

Thanks all. How to mark it as resolved? I don't see the toggle button next NewReply The other wild thing is that although I subscribed the thread but no email notification received.
loves General Coding Help 12 4,555 Nov-22-2020, 03:50 PM
    Thread: How to create a linked list and call it?
Post: RE: How to create a linked list and call it?

Thanks for your input. But I don't want a fancy solution. I just want to know what is wrong in my code so I can improve myself step as step. It is important for a beginner.
loves General Coding Help 12 4,555 Nov-21-2020, 07:13 PM
    Thread: How to create a linked list and call it?
Post: RE: How to create a linked list and call it?

I got an error AttributeError: 'int' object has no attribute 'val'. I am a python beginner and could you please correct my code instead of comments. Many thanks. class ListNode: def __init__(sel...
loves General Coding Help 12 4,555 Nov-21-2020, 02:22 PM
    Thread: How to create a linked list and call it?
Post: RE: How to create a linked list and call it?

It is a Letcode problem. https://leetcode.com/problems/add-two-numbers/ I can't print the result as expected. I got the result as <__main__.ListNode object at 0x000001F595801190> in Spyder.
loves General Coding Help 12 4,555 Nov-20-2020, 11:23 PM
    Thread: How to create a linked list and call it?
Post: How to create a linked list and call it?

I want to create a linked list and insert dummy data to verify it. Please see my code. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next a...
loves General Coding Help 12 4,555 Nov-20-2020, 09:42 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020