摘要:
Q:For a given sorted array (ascending order) and atargetnumber, find the first index of this number inO(log n)time complexity.If the target number doe... 阅读全文
摘要:
Q:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from... 阅读全文
摘要:
Q:A: binary search, pay attention to boundary casesjava version 1public class Solution { public int searchInsert(int[] nums, int target) { i... 阅读全文
摘要:
Q:Given a collection of numbers that might contain duplicates, return all possible unique permutations.A: recursionjava version 1import java.util.Arra... 阅读全文
摘要:
Q: Given a collection of numbers that might contain duplicates, return all possible unique permutations.A: recursionjava version 1import java.util.Arr... 阅读全文
摘要:
Leetcode 90 subsets 2, LintcodeQ:Given a collection of integers that might contain duplicates,nums, return all possible subsets.Note:Elements in a sub... 阅读全文
摘要:
Q:Given a set of distinct integers,nums, return all possible subsets.Note:Elements in a subset must be in non-descending order; The solution set must ... 阅读全文
摘要:
Leetcode 28Q:Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.A: 本题追求代码简单省额外空间则用nested loop; 追... 阅读全文