Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 罗马数字规则: 1, 罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。 罗马数字中没有“0”。
题目链接 class Solution {public int searchInsert(int[] nums, int target) {int len = nums.length;int left = 0;int right = len - 1;int index = -1;while(left <= len / 2){if(nums[left] == target || target <
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.