Search
所难
这个作者很懒,什么都没留下…
展开
-
LeetCode-Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found原创 2014-08-16 17:11:50 · 352 阅读 · 0 评论 -
LeetCode-Search Insert Position
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.原创 2014-08-16 16:54:39 · 265 阅读 · 0 评论 -
LeetCode-Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur原创 2014-08-16 22:22:12 · 462 阅读 · 0 评论 -
LeetCode-Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Solution:Code:class Solution原创 2014-08-19 14:55:39 · 373 阅读 · 0 评论 -
LeetCode-Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the原创 2014-08-08 22:05:46 · 346 阅读 · 0 评论 -
LeetCode-Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each原创 2014-08-10 10:54:38 · 314 阅读 · 0 评论 -
LeetCode-Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically原创 2014-08-09 09:56:00 · 274 阅读 · 0 评论