当前位置:网站首页>js 2023. String pair equal to the target string after connection
js 2023. String pair equal to the target string after connection
2022-07-03 14:06:00 【Cupid510】
To give you one Numbers Array of strings nums And a Numbers character string target , Please return nums[i] + nums[j] ( Two string connections ) The result is equal to the target The subscript (i, j) ( Need to meet i != j) Number of .
Example 1:
Input :nums = [“777”,“7”,“77”,“77”], target = “7777”
Output :4
explain : Subscript pairs that meet the requirements include :
- (0, 1):“777” + “7”
- (1, 0):“7” + “777”
- (2, 3):“77” + “77”
- (3, 2):“77” + “77”
Example 2:
Input :nums = [“123”,“4”,“12”,“34”], target = “1234”
Output :2
explain : Subscript pairs that meet the requirements include
- (0, 1):“123” + “4”
- (2, 3):“12” + “34”
source : Power button (LeetCode)
/** * @param {string[]} nums * @param {string} target * @return {number} */
var numOfPairs = function(nums, target) {
let count = 0
for(let i =0;i<nums.length;i++){
for(let j =0;j<nums.length;j++){
if(nums[i]+""+nums[j]==target && i !=j){
count++
}
}
}
return count
console.log(count)
};
边栏推荐
- 核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
- Use vscode to view hex or UTF-8 codes
- JVM object lifecycle
- FPGA测试方法以Mentor工具为例
- Analysis of the characteristics of page owner
- Article content typesetting and code highlighting
- Example analysis of QT learning 18 login dialog box
- QT learning 21 standard dialog box in QT (Part 2)
- JS new challenges
- Redis: operation command of string type data
猜你喜欢

信创产业现状、分析与预测

Qt学习23 布局管理器(二)

Summary of common error reporting problems and positioning methods of thrift

QT learning 22 layout manager (I)

Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)

QT learning 25 layout manager (4)

Use and design of Muduo buffer class

Uniapp tips - scrolling components

Redis: commandes d'action pour les données de type chaîne
![[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
随机推荐
从零开始的基于百度大脑EasyData的多人协同数据标注
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
Summary of common error reporting problems and positioning methods of thrift
如何使用lxml判断网站公告是否更新
MySQL 数据增删改查综合案例
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
How to use lxml to judge whether the website announcement is updated
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
Golang — template
SQL Injection (GET/Search)
Common mixins
Page generation QR code
Selenium browser (1)
Ocean CMS vulnerability - search php
Installation impression notes
Back to top implementation
小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。