计算机科学与技术152 (青海大学)

  • 爬楼梯

    问题描述: 假设你正在爬楼梯,需要n步你才能到达顶部。但每次你只能爬一步或者两步,你能有多少种不同的方法爬到楼顶部? 样例: n=3,1+1+1=1+2=2+1=3,共有3中不同的方法 数据输入:1 2 3 4 5 10 100 50 25 数据输出:1 2 3 5 8 89 null null 1
    qhu1500802073   2017-03-08 18:55   0   228
  • 买卖股票的最佳时机

    class Solution {public: int maxProfit(vector<int> &prices) { if(prices.size() == 0) return 0; int min=prices[0],max=0,sum=prices.size(); for(int i=0;i
    李富香   2017-03-08 18:36   0   105
  • 爬楼梯

    class Solution {public: /** * @param n: An integer * @return: An integer */ int climbStairs(int n) { // write your code here if(n==0) return 1; int su
    李富香   2017-03-08 18:31   0   106
  • 删除排序数组中的重复数字

    删除排序数组中的重复数字 class Solution {public: /** * @param A: a list of integers * @return : return an integer */ int removeDuplicates(vector<int> &nums) { //
    李富香   2017-03-08 18:30   0   84
  • 爬楼梯

    class Solution {public: /** * @param n: An integer * @return: An integer */ int climbStairs(int n) { // write your code here int a = 1, b = 1, k = 0;
    暴走的跳跳糖   2017-03-08 18:02   0   88
  • 买股票的最佳时机

    class Solution {public: /** * @param prices: Given an integer array * @return: Maximum profit */ int maxProfit(vector<int> &prices) { // write your co
    暴走的跳跳糖   2017-03-08 18:01   0   96
  • 删除排序数组中的重复数字

    class Solution {public: /** * @param A: a list of integers * @return : return an integer */ int removeDuplicates(vector<int> &nums) { // write your co
    暴走的跳跳糖   2017-03-08 17:58   0   102
  • 爬楼梯 C++

    // write your code here int one = 0; int two = 1; while(n>0) { two=one+two; one=two-one; n--; } return two;
    tong-joker   2017-03-07 23:01   0   326
  • 关于爬楼梯的lintcode代码

    讲真的,这个我只会用递归去做,但是lintcode上面超时,所以只有在网上找了个动态规划的,虽然这个程序懂了,但是我觉得还是挺不容易的真正弄懂的话…… class Solution {public: /** * @param n: An integer * @return: An integer *
    muzi_ln   2017-03-07 22:39   0   185
  • 关于股票最佳买卖时机的lintcode代码

    class Solution {public: /** * @param prices: Given an integer array * @return: Maximum profit */ int maxProfit(vector<int> &prices) { // write your co
    muzi_ln   2017-03-07 22:37   0   234