摘要: 思路:使用两个指针p1和p2遍历链表,p1在前p2在后。若p1指向的值小于p2指向的值,则p2向前走,直到二者不相等,然后更改p1的指针,再将p1和p2都向前走一步,这么做直到p2到达链表尾部。 阅读全文
posted @ 2017-10-02 13:04 蓦然闻声 阅读(124) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int searchInsert(vector& nums, int target) { int len=nums.size(); if(len nums[mid]) low=mid+1; else high=mid... 阅读全文
posted @ 2017-10-02 11:17 蓦然闻声 阅读(318) 评论(0) 推荐(0) 编辑