给定一个string数组str,其是由一个排过序的字符串数组插入了一些空字符串得到的,同时给定数组大小n和需要查找的string x,请用时间复杂度在log级别的算法返回该串的位置(位置从零开始)。 测试样例: ["a","b","","c","","d"],6,"c" 返回:3
加载中...
import java.util.*; public class Finder { public int findString(String[] str, int n, String x) { // write code here } }
class Finder { public: int findString(vector
str, int n, string x) { // write code here } };
# -*- coding:utf-8 -*- class Finder: def findString(self, s, n, x): # write code here
class Finder { public int findString(string[] str, int n, string x) { // write code here } }