当前位置:网站首页>318. maximum word length product
318. maximum word length product
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
Here's an array of strings words , Find out and return to length(words[i]) * length(words[j]) The maximum of , And these two words don't have a common letter . If there are no such two words , return 0 .
Example 1:
Input :words = ["abcw","baz","foo","bar","xtfn","abcdef"]
Output :16
explain : These two words are "abcw", "xtfn".
Example 2:
Input :words = ["a","ab","abc","d","cd","bcd","abcd"]
Output :4
explain : These two words are "ab", "cd".
Example 3:
Input :words = ["a","aa","aaa","aaaa"]
Output :0
explain : There are no such two words .
class Solution {
public int maxProduct(String[] words) {
int length = words.length;
int[] masks = new int[length];
for (int i = 0; i < length; i++) {
String word = words[i];
int wordLength = word.length();
for (int j = 0; j < wordLength; j++) {
masks[i] |= 1 << (word.charAt(j) - 'a');
}
}
int maxProd = 0;
for (int i = 0; i < length; i++) {
for (int j = i + 1; j < length; j++) {
if ((masks[i] & masks[j]) == 0) {
maxProd = Math.max(maxProd, words[i].length() * words[j].length());
}
}
}
return maxProd;
}
}
边栏推荐
- 聚焦行业,赋能客户 | 博云容器云产品族五大行业解决方案发布
- [bull Chinese document] queue package used to process distributed jobs and messages in nodejs
- 901. 股票价格跨度
- 900. RLE 迭代器
- 关于五险一金你需要知道的事情
- core.js是什么---kalrry
- WPF command directive and inotifypropertychanged
- [STL] summary of map usage of associated containers
- MySQL的意向共享锁、意向排它锁和死锁
- The illustration shows three handshakes and four waves. Xiaobai can understand them
猜你喜欢

Solve the mining virus sshd2 (redis does not set a password and clear the crontab scheduled task)

WPF command directive and inotifypropertychanged

406-双指针(27. 移除元素、977.有序数组的平方、15. 三数之和、18. 四数之和)

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

Copy and paste of idea without escape

Badly placed()'s problem

20220621 Three Conjugates of Dual Quaternions

Eureka

mysql 基础查询

XML schema record
随机推荐
centos7 mysql 记录
mysql 函数
About professional attitude
WPF command directive and inotifypropertychanged
Xiaobai must see in investment and wealth management: illustrated fund buying and selling rules
Idea installing the cloudtoolkit plug-in
Lombok的使用
MySQL mvcc multi version concurrency control
xml schem 记录
[graduation season · advanced technology Er] it's my choice. I have to walk on my knees
Linux Installation mysql8.0.25
MySQL optimization
MySQL function
System permission program cannot access SD card
Summarized benefits
C language operator priority formula
406-双指针(27. 移除元素、977.有序数组的平方、15. 三数之和、18. 四数之和)
Detailed explanation of callback function
.h5文件忘记数据库名字,使用h5py打印
mysql 索引