1、設計源碼<!DOCTYPE html><!--To change this license header, choose License Headers in Project Properties.To change this template file, choose Tools | Templatesand open the template in the editor.--><html> <head>
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the
--------------------------------------------------------------------------------------------------Author: YuManZI2014/06/23 1.1-3.6To Be Continued.-------------------------------------------------------------------------------------------------
Arrayss work well for unordered sequences, and even for ordered squences if they don't change much. But if you want to maintain an ordered list that allows quick insertions and deletions, you should use a linked data structure.
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off