389. Find the Difference(C语言)
来源:互联网 发布:怎么下载发票软件 编辑:程序博客网 时间:2024/06/14 20:39
这道题居然做得这么顺利, 果然刷题不能靠体力,要靠脑力!
就是想虽然你顺序不一样,但你值一样的,不就是多一个数吗,分别就和,然后做差,okay了 AC!分分钟搞定
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:s = "abcd"t = "abcde"Output:eExplanation:'e' is the letter that was added.
char findTheDifference(char* s, char* t) { int i=0; int num1=0,num2=0; int lens=strlen(s); int lent=strlen(t); for(i=0;i<lent;i++){ num1+=s[i]; num2+=t[i]; } return num2-num1;}
0 0
- 389. Find the Difference(C语言)
- LeetCode 389. Find the Difference 题解(C++)
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference*
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- App移动端项目管理
- 51NOD 1068 Bash游戏 V3 (大数模板套用) 博弈
- 1075 PAT Judge (25)
- XlistView
- 行业 | 基于Hadoop架构电子数据取证框架研究
- 389. Find the Difference(C语言)
- Educational Codeforces Round 20 F. Coprime Subsequences(容斥)
- 使用cocoapods时常见错误
- 3.搭建docker私有仓库,并上传下载镜像
- leetcode 463. Island Perimeter
- python-15-如何对字符串进行左,右,居中对齐?
- Android学习笔记——SQLite数据库案例【商品展示】
- Java中类实例化时该类中代码运行顺序
- Android事件分发和消费机制理解