Rust icon indicating copy to clipboard operation
Rust copied to clipboard

get longest palindrome

Open changweidalaifu6 opened this issue 1 year ago • 12 comments

Updated code and added comments

changweidalaifu6 avatar Apr 16 '24 03:04 changweidalaifu6

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.79%. Comparing base (a247720) to head (11bc144). Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #704      +/-   ##
==========================================
+ Coverage   94.55%   94.79%   +0.24%     
==========================================
  Files         296      298       +2     
  Lines       21984    22192     +208     
==========================================
+ Hits        20786    21037     +251     
+ Misses       1198     1155      -43     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 16 '24 03:04 codecov-commenter

Why did you close #703? This PR seems to be exactly the same as #703.

vil02 avatar Apr 16 '24 16:04 vil02

#703 It's not clear why the other tests didn't pass, I didn't change any of the other code.

changweidalaifu6 avatar Apr 17 '24 01:04 changweidalaifu6

#703 It's not clear why the other tests didn't pass, I didn't change any of the other code.

It is just some random failure - some tests in this repository are not deterministic. In general - this is not a big deal.

vil02 avatar Apr 17 '24 06:04 vil02

I thought it was my problem.....

changweidalaifu6 avatar Apr 17 '24 06:04 changweidalaifu6

In any case, the question about aabb from #703 remains valid.

vil02 avatar Apr 17 '24 06:04 vil02

aabb theoretically outputs either aa or bb, here it only outputs bb

changweidalaifu6 avatar Apr 17 '24 06:04 changweidalaifu6

I think that should be allowed.

changweidalaifu6 avatar Apr 17 '24 06:04 changweidalaifu6

The code looks quite good. Please update the doc string by adding some explanation how do you find the longest palindrome, adding a sentence about non-unique solution (I guess, your function returns the one most on the right).

Also, please add a test case with "aabb" (with a suitable comment).

vil02 avatar Apr 17 '24 19:04 vil02

This compilation error is a machine problem?

changweidalaifu6 avatar Apr 18 '24 05:04 changweidalaifu6

@changweidalaifu6 after rethinking the whole thing, I am not sure anymore if this contribution is suitable for this repository. The problem is very specific (it is a leetcode problem after all) and quite cumbersome to state properly (well, the function should be called something like get_length_of_the_palindrome_with_max_length).

vil02 avatar Apr 23 '24 19:04 vil02

It's true that it's a bit buttoned up, but it's very tight

changweidalaifu6 avatar Apr 24 '24 02:04 changweidalaifu6