博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[LeetCode]Search Insert Position
阅读量:4150 次
发布时间:2019-05-25

本文共 334 字,大约阅读时间需要 1 分钟。

class Solution {public:	int searchInsert(int A[], int n, int target) {		// Start typing your C/C++ solution below		// DO NOT write int main() function		int l = 0;		int r = n-1;		while (l <= r)		{			int mid = l+(r-l)/2;			if (A[mid] > target)				r = mid-1;			else if (A[mid] < target)				l = mid+1;			else return mid;		}		return l;	}};

转载地址:http://vqxti.baihongyu.com/

你可能感兴趣的文章
Build GingerBread on 32 bit machine.
查看>>
How to make SD Card world wide writable
查看>>
Detecting Memory Leaks in Kernel
查看>>
Linux initial RAM disk (initrd) overview
查看>>
Timestamping Linux kernel printk output in dmesg for fun and profit
查看>>
There's Much More than Intel/AMD Inside
查看>>
CentOS7 安装MySQL 5.6.43
查看>>
使用Java 导入/导出 Excel ----Jakarta POI
查看>>
本地tomcat 服务器内存不足
查看>>
IntelliJ IDAE 2018.2 汉化
查看>>
基于S5PV210的uboot移植中遇到的若干问题记录(一)DM9000网卡移植
查看>>
Openwrt源码下载与编译
查看>>
我和ip_conntrack不得不说的一些事
查看>>
Linux 查看端口使用情况
查看>>
文件隐藏
查看>>
两个linux内核rootkit--之二:adore-ng
查看>>
两个linux内核rootkit--之一:enyelkm
查看>>
关于linux栈的一个深层次的问题
查看>>
rootkit related
查看>>
配置文件的重要性------轻化操作
查看>>