LuckyGong's BLOG

LuckyGong的博客


  • 首页

  • 算法

  • 机器学习

  • 计算广告

  • NLP与知识图谱

  • 计算机视觉

  • 模型压缩

  • 分类

  • 关于博主

  • 归档

  • 标签

未命名

发表于 2020-01-31
阅读全文 »

169. Majority Element

发表于 2018-02-01 | 分类于 algorithm

题目描述

阅读全文 »

167. Two Sum II - Input array is sorted

发表于 2018-02-01 | 分类于 algorithm

题目描述

阅读全文 »

1.Two Sum

发表于 2018-02-01 | 分类于 algorithm

题目描述

阅读全文 »

实体抽取

发表于 2018-01-03 | 分类于 nlp

1.定义

阅读全文 »

分词与词性标注

发表于 2018-01-02 | 分类于 nlp

1.定义

阅读全文 »

词的向量表示

发表于 2018-01-01 | 分类于 nlp

1.one-hot encoding(词袋模型,最传统方式)

阅读全文 »

215.Kth Largest Element in an Array

发表于 2017-10-08 | 分类于 algorithm

题目描述

阅读全文 »

79.Word Search

发表于 2017-09-27 | 分类于 algorithm

题目描述

阅读全文 »

674. Longest Continuous Increasing Subsequence

发表于 2017-09-26 | 分类于 algorithm

题目描述

给定无序整数数组,计算最长连续递增子序列的长度。

我的解法

  • 遍历一遍
  • beat 70%
    class Solution {
      public int findLengthOfLCIS(int[] nums) {
          int len = nums.length;
          if(len == 0) return 0;
          int maxcon = 0;
          int nowcon = 1;
          for(int i = 1;i < len;i++){
              if(nums[i - 1] < nums[i])
                  nowcon++;
              else{
                  if(maxcon < nowcon)
                      maxcon = nowcon;
                  nowcon = 1;
              }
          }
          if(maxcon < nowcon)
              maxcon = nowcon;
          return maxcon;
      }
    }
    

    简便解法

      public int findLengthOfLCIS(int[] nums) {
          int res = 0, cnt = 0;
          for(int i = 0; i < nums.length; i++){
              if(i == 0 || nums[i-1] < nums[i]) 
                  res = Math.max(res, ++cnt);
              else 
                  cnt = 1;
          }
          return res;
      }
    
阅读全文 »
1 … 14 15
LuckyGong

LuckyGong

中科院计算所硕士研究生 NLP/数据挖掘/机器学习

150 日志
8 分类
RSS
© 2020 LuckyGong
由 Jekyll 强力驱动
主题 - NexT.Pisces