当前位置:网站首页>300. longest increasing subsequence
300. longest increasing subsequence
2022-06-23 07:08:00 【Graduation_ Design】
Preface
C++ It's a high-level programming language , from C Language expansion and upgrading , As early as 1979 By Benjani · Strauss LUP is AT&T Developed by Bell studio .
C++ Both can be carried out C Process programming of language , It can also be used for object-based programming characterized by abstract data types , It can also carry out object-oriented programming characterized by inheritance and polymorphism .C++ Good at object-oriented programming at the same time , You can also do process based programming .
C++ Have the practical characteristics of computer operation , At the same time, it is also committed to improving the programming quality of large-scale programs and the problem description ability of programming languages .
Java Is an object-oriented programming language , Not only absorbed C++ The advantages of language , It's abandoned C++ The incomprehensible inheritance in 、 Concepts such as pointer , therefore Java Language has two characteristics: powerful and easy to use .Java As the representative of static object-oriented programming language , Excellent implementation of object-oriented theory , Allow programmers to do complex programming in an elegant way of thinking .
Java It's simple 、 object-oriented 、 Distributed 、 Robustness, 、 Security 、 Platform independence and portability 、 Multithreading 、 Dynamic and so on .Java Can write desktop applications 、Web Applications 、 Distributed system and embedded system applications, etc .
Python By Guido of the Dutch Society for mathematical and computer science research · Van rosum On 1990 It was designed in the early 's , As a course called ABC A substitute for language .Python Provides efficient advanced data structure , It's also a simple and effective way of object-oriented programming .Python Syntax and dynamic types , And the nature of interpretative language , Make it a programming language for scripting and rapid application development on most platforms , With the continuous update of the version and the addition of new language features , Gradually used for independent 、 Development of large projects .
Python The interpreter is easy to extend , have access to C Language or C++( Or something else can be done through C Calling language ) Expand new functions and data types .Python It can also be used as an extensible programming language in customizable software .Python Rich library of standards , Provides source code or machine code for each major system platform .
2021 year 10 month , Compiler for language popularity index Tiobe take Python Crowned the most popular programming language ,20 Put it in... For the first time in years Java、C and JavaScript above .
describe
Give you an array of integers nums , Find the length of the longest strictly increasing subsequence .
Subsequence Is a sequence derived from an array , Delete ( Or do not delete ) Elements in an array without changing the order of the rest . for example ,[3,6,2,7] It's an array [0,3,1,6,2,2,7] The subsequence .
Example 1:
Input :nums = [10,9,2,5,3,7,101,18]
Output :4
explain : The longest increasing subsequence is [2,3,7,101], So the length is 4 .
Example 2:
Input :nums = [0,1,0,3,2,3]
Output :4
Example 3:
Input :nums = [7,7,7,7,7,7,7]
Output :1
class Solution {
public int lengthOfLIS(int[] nums) {
if (nums.length == 0) {
return 0;
}
int[] dp = new int[nums.length];
dp[0] = 1;
int maxans = 1;
for (int i = 1; i < nums.length; i++) {
dp[i] = 1;
for (int j = 0; j < i; j++) {
if (nums[i] > nums[j]) {
dp[i] = Math.max(dp[i], dp[j] + 1);
}
}
maxans = Math.max(maxans, dp[i]);
}
return maxans;
}
}
边栏推荐
- Cetos7 record
- [STL] summary of deque usage of sequential containers
- Analyzing the creation principle in maker Education
- 【BULL中文文档】用于在 NodeJS 中处理分布式作业和消息的队列包
- Too much if logic in JS, common optimization
- 直播回顾 | 传统应用进行容器化改造,如何既快又稳?
- deeplab v3 代码结构图
- MySQL redo log redo log
- MySQL重做日志 redo log
- Regular expression graph and text ultra detailed summary without rote memorization (Part 1)
猜你喜欢

Xxl-sso enables SSO single sign on

The illustration shows three handshakes and four waves. Xiaobai can understand them

MySQL Redo log Redo log

redux Actions may not have an undefined “type“ property. Have you misspelled a constant?

【STL】关联容器之unordered_map用法总结
![[bull Chinese document] queue package used to process distributed jobs and messages in nodejs](/img/f9/1bd79d3754c1b4d1b114d02283f95e.png)
[bull Chinese document] queue package used to process distributed jobs and messages in nodejs

直播回顾 | 传统应用进行容器化改造,如何既快又稳?

Idea automatically generates serialVersionUID

【BULL中文文档】用于在 NodeJS 中处理分布式作业和消息的队列包

RFID数据安全性实验:C#可视化实现奇偶校验、CRC冗余校验、海明码校验
随机推荐
[shell] tree command
ssm + ftp +ueditor
307. 区域和检索 - 数组可修改
MySQL的意向共享锁、意向排它锁和死锁
asp. Net file download demo and related problems
深度学习系列47:styleGAN总结
Analysis of personalized learning progress in maker Education
技术文章写作指南
898. 子数组按位或操作
【项目实训】线形箭头的变化
XML schema record
Detailed explanation of callback function
What are the pension financial products in 2022? Low risk
About Supervision
图解三次握手四次挥手,小白都能看懂
315. calculate the number of elements on the right that are smaller than the current element
Intentional shared lock, intentional exclusive lock and deadlock of MySQL
Idea installing the cloudtoolkit plug-in
关于五险一金你需要知道的事情
【STL】pair用法总结