problem 893. Groups of Special-Equivalent Strings 题意: 感觉参考代码也是有点问题的... 参考 1. Leetcode_easy_893. Groups of Special-Equivalent Strings; 2. grandyang; 3. discuss; 完…
Algorithm [leetcode]893. Groups of Special-Equivalent Strings https://leetcode.com/problems/groups-of-special-equivalent-strings/ 1)problem You are given an array A of strings. Two strings S and T are special-equivalent if after any number of moves,…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.com/problems/groups-of-special-equivalent-strings/description/ 题目描述 You are given an array A of strings. Two strings S and T are special-equivalent if…
problem 1071. Greatest Common Divisor of Strings solution class Solution { public: string gcdOfStrings(string str1, string str2) { return (str1+str2==str2+str1) ? (str1.substr(, gcd(str1.size(), str2.size()))) : ""; } }; 参考 1. Leetcode_easy_1071…
title: [概率论]5-1:分布介绍(Special Distribution Introduction) categories: - Mathematic - Probability keywords: - Distribution toc: true date: 2018-03-27 20:35:20 Abstract: 本文介绍本章关于分布的内容提要 Keywords: Distribution 开篇废话 这篇就是个介绍,会非常短,但是还是有点点信息在里面的比如,给了一个分布的家族分类…
problem 1128. Number of Equivalent Domino Pairs solution1: 不明白为什么每个元素都要加上count: class Solution { public: int numEquivDominoPairs(vector<vector<int>>& dominoes) { ; unordered_map<int, int> count; for(auto d:dominoes) { res += count[mi…
problem 830. Positions of Large Groups solution1: class Solution { public: vector<vector<int>> largeGroupPositions(string S) { vector<vector<int>> res; , end = ; ; i<S.size(); ++i) { ]) end = i; ]) { ) res.push_back({start, end}…
题目大意:给定 N 个点和一些有向边,求是否能够将这个有向图的点分成两个集合,使得同一个集合内的任意两个点都有双向边联通. 题解:反向思考,对于没有双向边的两个点一定不能在同一个集合中.因此,构建一个图,若两点之间有边,则表示这两个点不能在同一个集合中.进行二分图染色判定即可,若是二分图,则满足条件,反之则不满足. 代码如下 #include <bits/stdc++.h> #define pb push_back using namespace std; const int maxn=110…
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完…
problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binary Numbers; 完…