Open Zortexxx619 opened 1 week ago
LeetCode Support commented: Hello,
Thank you for contributing to LeetCode and submitting a missing test case. Upon review, we found that your provided test case did not cause your solution code to fail and it was Accepted as before. This indicates that your test case may not address the specific edge case or scenario needed to highlight the issue in your solution.
Here are the test cases you submitted:
Test case #1:
"0x3b"
We encourage you to review your code and consider other potential edge cases that might reveal the underlying problem. If you identify any additional test cases or have further questions, please feel free to reply to this message or open a new issue with us.
We appreciate your engagement and efforts in helping us enhance our platform.
Best regards, LeetCode Support Team
Hello there! I'm not sure I understand what you mean. The testcase being accepted by my solution is in fact true, I'm not arguing that. I'm saying it shouldn't be accepted per the details of the problem description.
LeetCode Support commented: Hello Zortexxx619,
Thank you for bringing this to our attention. We understand there may be some confusion regarding the behavior of hexadecimal numbers like "0x3b" within the context of this problem. To ensure that we fully understand and address the issue, could you provide additional clarity or examples demonstrating where the current problem constraints might be insufficient or misaligned with what should be expected? Your detailed insight will help us determine if there’s indeed a missing test case or if there's another aspect to consider.
We value your input and are here to assist you in aligning your solutions with problem expectations. Feel free to share any further details or ask additional questions.
Warm regards,
LeetCode Support Team
LeetCode Username
Zortexxx619
Problem Number, Title, and Link
Bug Category
Missing test case (Incorrect/Inefficient Code getting accepted because of missing test cases)
Bug Description
When using the C++ standard library,
std::from_chars
can easily be used to convert the string to a float and solve this problem, so long as:'+'
is skipped, and it is ensured that the entire string isn't"+"
.std::isfinite
, to avoid false positives with"inf"
or"NaN"
.from_chars
function is checked to ensure the entire string was used, and not just an initial portion.Notably,
from_chars
also supports automatically detecting and converting strings of hexadecimal numbers, as long as they start with"0x"
or"0X"
. There are, however, no testcases which start with those and are also valid hexadecimal strings, meaning the problem can be solved this way without accounting for these false positives.Language Used for Code
C++
Code used for Submit/Run operation
Expected behavior
Given this code, a testcase such as
"0x3b"
(a hexadecimal number prepended with"0x"
or"0X"
, valid in its entirety as far asfrom_chars
is concerned) would returntrue
, whereas it should expectfalse
given the rules laid out in the problem description. No testcases like that exist, so the solution is accepted.A single added testcase can fix this issue, without impacting solutions that opt to write parsers from scratch.
Screenshots
No response
Additional context
No response