929. Unique Email Addresses(java)

从零开始:使用Mask2Former训练你的专属数据集 本文详细介绍了如何从零开始使用Mask2Former训练自定义数据集。内容涵盖环境搭建、数据准备(将LabelMe格式转换为COCO格式)、数据集注册与模型配置、训练启动与调试,以及最终的模型推理与应用。通过实战步骤和常见问题解决方案,帮助读者掌握使用Mask2Former进行实例分割的核心流程,实现专属模型的训练与部署。 阅读详情

经过一轮来不及准备的面试,我应该知道了自己几斤几两了,,, 奋发刷题,记录下自己的解题过程,以及一些遇到的需要注意的问题。 

意向java方向,java还是在大一学的,大三重拾处处是坑。

上题:大意是要去掉email里面本地名里面的 “.” 和“+”后面的部分。

  public static int numUniqueEmails(String[] emails) {
        int num=0;
			String str, tmp1, t;
			for(int i=0; i<emails.length; i++)
			{
				str = emails[i]; 
				emails[i] = str.substring(str.indexOf( "@"));//@后面的
				tmp1 = str.replace(".", "");//去掉 。 
				 
				if(tmp1.indexOf("+")>0) 
					emails[i] = tmp1.substring(0, tmp1.indexOf( "+")-1) + emails[i];		
				else
					emails[i] = tmp1.substring(0, tmp1.indexOf( "@")) + emails[i];  
			} 
			
			for(int i=0; i<emails.length; i++) 
				for(int j=0; j<emails.length; j++) 
					if(emails[i].equals(emails[j]) && i!=j) 
						emails[j] = "";   
			
	        for(int i=0; i<emails.length; i++) 
	            if(emails[i]!="")
	                num++; 
			return num;	        
	    } 

注意点:

String.replace() String.replaceAll() 两者不一样,后者是为正则表达式设立的,要注意特殊字符,比如+ 在后者要写成“\\+”转义一下。

emails[i].equals(emails[j]) 这里不能用==,两者地址不一样。

 

 

【物理模拟】PBD算法详解 参考MatthiaMuller的十分钟物理(他就是PBD算法的发明者) 阅读详情

相关推荐

Android存储方案对比(SharedPreferences 、 MMKV 、 DataStore)

简介:本文介绍了Android开发中常用的键值对存储方案,包括SharedPreferences、MMKV和DataStore,并且对比了它们在性能、并发处理、易用性和稳定性上的特点。通过实际代码示例,帮助开发者根据项目需求选择最适合的存储方案,提升应用性能和用户体验。

LiuYong_01的博客 1780

LeetCode929 Unique Email Addresses(独特的电子邮件地址) C++实现

Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name. Besides lowercase l...

帽帽的博客 5372

基于微信小程序的智能门禁管理系统的设计与实现(文章+源码)

基于微信小程序门禁管理小程序,该系统支持用户注册登录、查阅新闻动态、提交开门申请和发布留言等功能,同时管理员可以进行用户管理、新闻信息管理、门禁审批管理和留言管理等操作。该系统将采用IDEA开发工具、SSM框架和MYSQL数据库等相关技术,实现用户登录注册、个人信息管理、门禁申请提交、管理员审核等功能。该系统的实现,可以有效提高门禁管理的效率和便利性,同时也具有较强的可扩展性和可维护性。本研究对于智能门禁管理系统的设计和实现具有一定的参考价值。

u011779145的博客 1397

Java/929. Unique Email Address 独特的电子邮件地址

题目       代码部分一(96ms 26.74%) class Solution { public int numUniqueEmails(String[] emails) { Set&lt;String&gt; set = new HashSet&lt;&gt;(); int res = 0; St...

qq_38959715的博客 2381

避开STM32中断优先级配置的坑:HAL_NVIC_SetPriority()参数你真的用对了吗?

本文深入解析STM32中断优先级配置中的关键问题,重点剖析HAL_NVIC_SetPriority()函数的正确使用方法。通过实际案例揭示优先级分组设置、抢占优先级与子优先级的区别,提供多中断系统中的优化策略和调试技巧,帮助开发者避免常见配置错误,提升系统稳定性。

weixin_42532938的博客 421

从零构建2.4G无线通信系统:MSPM0G3507与NRF24L01的深度协同设计

本文详细介绍了基于MSPM0G3507微控制器与NRF24L01射频模块构建2.4G无线通信系统的深度协同设计方案。内容涵盖系统架构、SPI通信优化、功耗管理、抗干扰机制及中断/DMA高效利用,为工业物联网应用提供高可靠、低功耗的无线传输解决方案。

rice5的博客 820

LeetCode之Unique Email Addresses(Kotlin)

问题: Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name. Besides lowercas...

糕冷羊的博客 857

primetime如何做voltage scaling

存在这样的情况,标准单元库只有ssgnp0p72vm40c和ssgnp0p9vm40c的libs,但是我们希望它工作在ssgnp0p76vm40c,这样的话就需要用ssgnp0p72vm40c和ssgnp0p9vm40c的libs来scaling出ssgnp0p76vm40c的lib。

qq_34326957的博客 1683

929. Unique Email Addresses

Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name. Besides lowercase l...

Dive Deep into The Knowledge 551

RV1106的ISP配置实战:MIPI与LVDS接口的硬件连接与设备树优化

本文详细解析了RV1106芯片的ISP配置实战,重点对比了MIPI CSI-2与LVDS两种主流接口的硬件连接方案与数据流差异。通过手把手的设备树代码示例,深入讲解了单路MIPI与双路LVDS摄像头的配置要点、关键属性设置及常见避坑指南,并提供了从驱动加载检查到Media Controller工具使用的系统化调试方法,帮助开发者快速打通图像采集与处理全链路。

terraform7cloud的博客 469

伺服系统控制原理深度解析

摘要:本文系统阐述了伺服系统的控制原理与应用。首先介绍了伺服系统的定义、组成及其在工业自动化中的重要性;然后详细分析了反馈控制机制、稳定性判据和性能指标;重点推导了传递函数和状态空间两种数学模型,并通过LaTeX公式展示了二阶系统建模过程;进而对比了PID控制、状态反馈及自适应控制等方法的优缺点;最后结合数控机床等案例,验证了理论方法的有效性,并展望了伺服系统智能化发展趋势。全文兼顾理论深度与实践指导性,为控制工程领域提供了系统的技术参考。

技术工作者 1264

[LeetCode] 929. Unique Email Addresses 唯一的电邮地址

Every email consists of a local name and a domain name, separated by the @ sign. For example, inalice@leetcode.com,aliceis the local name, andleetcode.comis the domain name. Besides lowercase...

weixin_30677617的博客 602

YOLOv5_DeepSORT_Pytorch训练自己的多目标跟踪模型

1 准备 环境配置:https://blog.csdn.net/weixin_50008473/article/details/115250986?spm=1001.2014.3001.5501 YOLOv5_DeepSORT_Pytorch代码地址: https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch DeepSORT论文:https://arxiv.org/pdf/1703.07402.pdf 2 训练目标检测模型 训练自己的目标检测模

weixin_50008473的博客 1万+

LeetCode 929.Unique Email Addresses【Java】

题目描述 独特的电子邮件地址 AC代码 /* 拿到一个邮件地址之后: 1.根据@将用户名和域名分隔开 2.将用户名根据+/.过滤,生成新用户名 3.将用户名和域名合并起来生成一个新邮箱,存放到hash表里 4.输出hash表的元素个数即可 */ class Solution { public int numUniqueEmails(String[] emails) { Ha...

NayelyA的博客 300

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

LeetCode 929 Unique Email Addresses--python一行解法,Java解法

Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name. Besides lowercase let...

个人博客 712

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

929. Unique Email Address

If you add a plus ('+') in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered, for example m.y+name@email.com will be forwarded to my@email...

PIG_CODE的博客 1016

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

leetcode929 Unique Email Addresses

Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name. Besides lowerc...

datai3890的博客 276

LeetCode 929. Unique Email Addresses

Every email consists of a local name and a domain name, separated by the @ sign. For example, inalice@leetcode.com,aliceis the local name, andleetcode.comis the domain name. Besides lowercase l...

lmxr133的博客 302

Leetcode 929 Unique Email Addresses

class Solution { public int numUniqueEmails(String[] emails) { List&lt;String&gt; back=new LinkedList&lt;&gt;(); int ans=0; int emails_len=emails.length; for(int i...

Polanwind 229

leetcode929-Unique Email Addresses

输入:emails = [“test.email+alex@leetcode.com”,“test.e.mail+bob.cathy@leetcode.com”,“testemail+david@lee.tcode.com”]解释:实际收到邮件的是 “testemail@leetcode.com” 和 “testemail@lee.tcode.com”。例如,"alice.z@leetcode.com” 和 “alicez@leetcode.com” 会转发到同一电子邮件地址。可以同时使用这两个规则。

我的程序人生 615

【Leetcode】929. Unique Email Addresses

题目地址: https://leetcode.com/problems/unique-email-addresses/ 给定若干邮箱地址,要求用户名部分按照这样的方式解析:如果遇到小数点则忽略,遇到加号则忽略其后的所有字符。问这些邮箱地址解析后有多少个不同的。代码如下: import java.util.HashSet; import java.util.Set; public class Solution { public int numUniqueEmails(String[] emails)

数学、算法爱好者的博客 217

【LeetCode】Unique Email Addresses(独特的电子邮件地址)

这道题是LeetCode里的第929道题。 题目要求: 每封电子邮件都由一个本地名称和一个域名组成,以 @ 符号分隔。 例如,在alice@leetcode.com中,alice是本地名称,而leetcode.com是域名。 除了小写字母,这些电子邮件还可能包含'.'或'+'。 如果在电子邮件地址的本地名称部分中的某些字符之间添加句点('.'),则发往那里的邮件将会转发...

『诞生之时已至,以此修正万象』 3421

leetcode 929. Unique Email Addresses

class Solution { public int numUniqueEmails(String[] emails) { Set<String> s = new HashSet<String>(); for (String e: emails) { int idx = e.indexOf("@"); ...

weixin_30847271的博客 79

929. Unique Email Addresses [Easy]

可以锻炼使用java String的split()、replacAll()等方法和正则表达式的题 思路很简单,但实现时有坑: 用'.'字符分割字符串,不能用s.split("."),因为'.'是特殊字符,而split()是用正则表达式匹配参数 这里需要用"\\."或"[.]"作为参数。 /** * Runtime: 7 ms, faster than 87.20% * Memory Usage: 39.3 MB, less than 62.20% */ class Solution {

汋灼的博客 213

leetcode讲解--929. Unique Email Addresses

929. Unique Email Addresses Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, ...

weixin_33709590的博客 252
上一篇: 源映射错误:request failed with status 404
下一篇: 804. Unique Morse Code Words(java)
monkey1008611
博客等级 码龄10年 14粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值