We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0, 0, 1, 2, 4, 5, 6, 7, 8, 9],这样的样例从第一次二分的时候,就发现不了正确的重复区间了,因为第一次遍历时候,发现[0, 4]范围内是5个数字,所以认为重复出现在[5, 9],所以出现了错误。想问一下这个要如何解决? 我想到一种方法:对[0, 4]找到的该区间的数字进行求和,如果出现了5:5的情况,且求和的值也符合预期,那么才可能会出现在后半部分(反例,[0, 0, 3, 3, 4], 5:5, 且求和的值也还是10= [0, 4]的总和)
The text was updated successfully, but these errors were encountered:
比如{1,1,2,2,5,6,7,8,9} 本来的代码应该就找不出答案
Sorry, something went wrong.
{2,2,3,3,5,5,6,6} 这种肯定找不到
该题题目是在n+1长度的数组中的数组在1~n范围内。所以这个本就不符合题意
该题题解无法解决0重复出现应该是因为在 if (count > (mid - start + 1)) end = mid 如果start为0 会导致count = mid 无法正确二分
if (count > (mid - start + 1)) end = mid
No branches or pull requests
[0, 0, 1, 2, 4, 5, 6, 7, 8, 9],这样的样例从第一次二分的时候,就发现不了正确的重复区间了,因为第一次遍历时候,发现[0, 4]范围内是5个数字,所以认为重复出现在[5, 9],所以出现了错误。想问一下这个要如何解决?
我想到一种方法:对[0, 4]找到的该区间的数字进行求和,如果出现了5:5的情况,且求和的值也符合预期,那么才可能会出现在后半部分(反例,[0, 0, 3, 3, 4], 5:5, 且求和的值也还是10= [0, 4]的总和)
The text was updated successfully, but these errors were encountered: