分类: coding , leetcode 标签: coding , leetcode 好文要顶 关注我 收藏该文 微信分享 zhanzq1 粉丝- 1 关注- 0 +加关注 0 0 « 上一篇: leetcode 387. 字符串中的第一个唯一字符(First Unique Character in a String) » 下一篇: leetcode 400. 第N个数字(Nth Digit) posted...
publiccharfindTheDifference(String s, String t){int[] arr =newint[26];for(inti=0; i<t.length(); i++) { arr[t.charAt(i)-'a']++; }for(intj=0; j<s.length(); j++) { arr[s.charAt(j)-'a']--; }for(intk=0; k<arr.length; k++) {if(arr[k] ==1) {return(char)(k...
[2316. 统计无向图中无法互相到达点对数](https://leetcode.cn/problems/count-unreachable-pairs-of-nodes-in-an-undirected-graph/) [1391. 检查网格中是否存在有效路径](https://leetcode.cn/problems/check-if-there-is-a-valid-path-in-a-grid/) [1697. 检查边长度限制的路径是否存在](https://leetc...
1980-find-unique-binary-string.py 1985-Find-The-Kth-Largest-Integer-In-The-Array.py 1985-find-the-kth-largest-integer-in-the-array.py 2013-Detect-Squares.py 2013-detect-squares.py 2017-Grid-Game.py 2017-grid-game.py 232-Implement-Queue-Using-Stacks.py 236-Lowest-...
find whether two elements in the same group (Find) merge two groups of elements (Union) Here is an example story to help you understand Union Find. A, B, C three people work for M company. We assign them each a parent pointer to M. ...
1857-largest-color-value-in-a-directed-graph.rs 1929-concatenation-of-array.rs 1930-unique-length-3-palindromic-subsequences.rs 1963-minimum-number-of-swaps-to-make-the-string-balanced.rs 1984-minimum-difference-between-highest-and-lowest-of-k-scores.rs 2001-number-of-pairs-of-interchangeable-re...
letters has a length in range [2, 10000]. letters consists of lowercase letters, and contains at least 2 unique letters. target is a lowercase letter. 思路: 因为wrap around,所以当给的target大于最大元素,就取集合中最小字符。否则,取大于target的第一个元素。(集合需要排序) ...
1classSolution {2func findReplaceString(_ S: String, _ indexes: [Int], _ sources: [String], _ targets: [String]) ->String {3varS =S4varv:[[Int]] =[[Int]]()5foriin0..<indexes.count6{7v.append([indexes[i], i])8}9v.sort(by:{(a:[Int],b:[Int]) -> Boolin10ifa[0] ...
LeetCode #389. Find the Difference 题目 389. Find the Difference 解题方法 先统计两个字符串中每个字母的出现次数,记为dic_s和dic_t,先遍历dic_s,找一个在dic_t中没出现的字母,或者在dic_t中出现了但是频数和dic_s中不一样的字母,找到了就break不做了,要是没找到就再去dic_t中找和dic_s中不一样...
1857-largest-color-value-in-a-directed-graph.rs 1929-concatenation-of-array.rs 1930-unique-length-3-palindromic-subsequences.rs 1963-minimum-number-of-swaps-to-make-the-string-balanced.rs 1984-minimum-difference-between-highest-and-lowest-of-k-scores.rs 2001-number-of-pairs-of-interchangeable-rec...