LeetCode
文章平均质量分 61
B1009
这个作者很懒,什么都没留下…
展开
-
Median of two sorted array
There are two sorted arrays nums1 and nums2 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)). Example 1: nums1 =原创 2017-03-19 21:44:42 · 318 阅读 · 0 评论 -
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 i原创 2017-03-19 21:42:11 · 229 阅读 · 0 评论 -
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 sam原创 2017-03-19 21:38:43 · 235 阅读 · 0 评论 -
KMP
void getNext(string s, vector<int>& next) { next[0] = 0; int p_len = s.length(); int i = 1; int j_len = 0; for (; i < p_len; i++) { while (j_len > 0 &...原创 2018-12-19 15:39:06 · 119 阅读 · 0 评论 -
排序
#include <iostream> #include <vector> using namespace std; void merge(vector<int>& nums, int start, int middle, int end) { int len = end - start; vector<int> temp(len ...原创 2019-01-06 12:12:20 · 136 阅读 · 0 评论