摘要:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
摘要:
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)).思考:既然是有序数组,自然想到折半搜索。每次比较去掉其中一个数组一半的数字。class Solution {public: int func(int *A,int m,int *B,int n,int k) { if(m>n) return func(B,n,A,m, 阅读全文
摘要:
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文