- 博客(4)
- 收藏
- 关注
原创 4. Median of Two Sorted Arrays
findKth(A,B,k)函数思路如下: 1. 保持A是短的那一个数组,B是长的 2. 平分k, 一半在A,一半在B (如果A的长度不足K/2,那就pa就指到最后一个) 3. 如果pa的值 < pb的值,那证明第K个数肯定不会出现在pa之前,递归,把A数组pa之前的砍掉,同理递归砍B数组。 4. 递归到 m == 0 (短的数组用完了) 就返回 B[k - 1], 或者k == 1(找第一
2017-08-30 20:30:39 286
原创 3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the le
2017-08-30 11:20:16 236
原创 2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2017-08-18 16:45:59 225
原创 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same ele
2017-08-18 16:13:54 204
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人