题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target valu...
分类:
编程语言 时间:
2015-01-27 23:29:46
阅读次数:
256
/************************************************************************/ /* 39.1: Convert Sorted Array to Binary Search Tree */ /***************...
分类:
其他好文 时间:
2015-01-27 23:22:42
阅读次数:
175
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'23: Merge k Sorted Listshttps://oj.leetcode.com/problems/merge-k-sorted-lists/Merge k sort...
分类:
编程语言 时间:
2015-01-27 23:08:46
阅读次数:
244
原题链接:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/
很简单的题,维持一个front标志和prev维持之前的值,边扫边比较。
class Solution {
public:
int removeDuplicates(int A[], int n) {
if ...
分类:
其他好文 时间:
2015-01-27 18:34:54
阅读次数:
190
Redis 在新浪微博中的应用Redis简介1. 支持5种数据结构支持strings, hashes, lists, sets, sorted setsstring是很好的存储方式,用来做计数存储。sets用于建立索引库非常棒;2. K-V 存储 vs K-V 缓存新浪微博目前使用的98%都是持久化...
分类:
其他好文 时间:
2015-01-27 18:02:41
阅读次数:
202
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.思路分析:这题是 LeetCode Sort List需要使用的merge两个有序链表使得结果仍然有序这个子过程,详细...
分类:
其他好文 时间:
2015-01-27 15:05:13
阅读次数:
134
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The...
分类:
其他好文 时间:
2015-01-27 14:57:01
阅读次数:
149
原题链接:https://oj.leetcode.com/problems/merge-two-sorted-lists/
这道题用指针的指针实现,做法会非常简单干净。直接上代码
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
*...
分类:
其他好文 时间:
2015-01-27 14:56:08
阅读次数:
109
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function ...
分类:
其他好文 时间:
2015-01-27 13:19:46
阅读次数:
141
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'21: Merge Two Sorted Listshttps://oj.leetcode.com/problems/merge-two-sorted-lists/Merge tw...
分类:
编程语言 时间:
2015-01-27 07:03:06
阅读次数:
681