<p>I'm new to Go and I need another set of eyes. Here's a link to the code <a href="https://stackoverflow.com/questions/46137083/kth-highest-of-two-sorted-arrays" rel="nofollow">https://stackoverflow.com/questions/46137083/kth-highest-of-two-sorted-arrays</a></p>
<p>When the value of k is set to 2 through 6, it seems to work, but when it's set to 1, the result is set to 0, when it should be 1. When it's set to 7 the result is 3 and setting it higher than 7, the execution times out. Am I just totally over looking an error in my logic?</p>
<p>Any help is appreciated. Thanks!</p>
<hr/>**评论:**<br/><br/>alercah: <pre><p>If k is 0 or 1, then highA and highB will be negative, which seems like a good place to start looking for issues.</p>
<p>If you know it doesn't work with 7, for logic this simple, you can even trace through it yourself to see where you're going wrong.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传