k'th highest of two sorted arrays

agolangf · · 326 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m new to Go and I need another set of eyes. Here&#39;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&#39;s set to 1, the result is set to 0, when it should be 1. When it&#39;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&#39;t work with 7, for logic this simple, you can even trace through it yourself to see where you&#39;re going wrong.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

326 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传