Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug Report for palindromic-substrings #3887

Closed
@jinxuan-owyong

Description

@jinxuan-owyong

Bug Report forhttps://neetcode.io/problems/palindromic-substrings

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

The code below was submitted on both neetcode.io and leetcode.com. It was accepted on neetcode.io, but rejected on leetcode.com, which made me realise I made a small mistake while writing my solution. Narrowed down the missing test case on neetcode.io to"abca", which is correctly marked as wrong answer when run as a test case, but not checked during submission.

classSolution:defcountSubstrings(self,s:str)->int:defcountPalindromes(i:int,j:int)->int:count=int(s[i]==s[j])# <-- mistake herewhilei-1inrange(len(s))andj+1inrange(len(s))ands[i-1]==s[j+1]:i,j=i-1,j+1count+=1returncounttotal=0foriinrange(len(s)):total+=countPalindromes(i,i)ifi>0:total+=countPalindromes(i-1,i)returntotal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp