当前位置:网站首页>1408. String matching in arrays
1408. String matching in arrays
2022-08-06 16:28:00 【anieoo】
Original title link: 1408. In an arrayThe string matches

solution:
class Solution {public:vector stringMatching(vector& words) {vector res; //Define the return valuesort(words.begin(), words.end(),[](const string &a, const string &b){return a.size() == b.size() ? a < b : a.size() < b.size();}); //sortfor(int i = 0;i < words.size();i++)for(int j = i + 1;j < words.size();j++) {if(words[j].find(words[i]) != -1) {res.push_back(words[i]);break;}}return res;}}; 边栏推荐
猜你喜欢

小程序中实现搜索功能

dedecms织梦系统提示500错误解决方法

企业级监控服务器构建

Ant Group builds the industry's first full-picture risk control and explains the technical architecture in detail for the first time

海缆探测仪TSS350(三)

5G NR SIB1介绍

LeetCode·Daily Question·1408. String Matching in Array·Simulation

如何用WebGPU流畅渲染千万级2D物体:基于光追管线

MT6853/MT6873 视频彩铃概率性无图像

shell之常用小工具(sort、uniq、tr、cut)
随机推荐
Understand the principles of xss, csrf, ddos attacks and how to avoid them
我的笔记汇总(整理中)
SAP ABAP OData 服务的分页加载数据集的实现(Paging)试读版
《A Biography of the Pixel》摘阅
Coggle 30 Days of ML【打卡】广告-信息流跨域ctr预估
MODBUS转PROFINET网关将电力智能监控仪表接入PROFINET网络案例
预解析案例
In-depth understanding of AVLTree [rotation control balance (single rotation, double rotation)]
启牛帮开通的中信证券VIP账户是安全的吗?怎么开
JVM:(二)类加载子系统
There is a blank solution for the editor of the article published in the background of the dream weaving
深入理解AVLTree【旋转控制平衡(单旋、双旋)】
cmd command line tool
SAP CRM Fiori 应用 My Opportunity 的分页读取逻辑,在 GM4 - AG3 无法正常工作
ERP为化工企业的采购决策提供技术支持
小程序图片转base64方案(多种解决方案)
【NLP】一文简要了解词义消歧与实体消歧
Auto.js 找图防止泄漏
05、GO数组与切片
The JVM: (3) the runtime data area