https://leetcode.com/problems/groups-of-special-equivalent-strings/html
You are given an array A
of strings.前端
Two strings S
and T
are special-equivalent if after any number of moves, S == T.ios
A move consists of choosing two indices i
and j
with i % 2 == j % 2
, and swapping S[i]
with S[j]
.程序員
Now, a group of special-equivalent strings from A is a non-empty subset S of A
such that any string not in S is not special-equivalent with any string in S.算法
Return the number of groups of special-equivalent strings from A
.docker
Example 1:數據庫
Input: ["a","b","c","a","c","c"] Output: 3 Explanation: 3 groups ["a","a"], ["b"], ["c","c","c"]
Example 2:編程
Input: ["aa","bb","ab","ba"] Output: 4 Explanation: 4 groups ["aa"], ["bb"], ["ab"], ["ba"]
Example 3:api
Input: ["abc","acb","bac","bca","cab","cba"] Output: 3 Explanation: 3 groups ["abc","cba"], ["acb","bca"], ["bac","cab"]
Example 4:安全
Input: ["abcd","cdab","adcb","cbad"] Output: 1 Explanation: 1 group ["abcd","cdab","adcb","cbad"]
Note:
1 <= A.length <= 1000
1 <= A[i].length <= 20
A[i]
have the same length.A[i]
consist of only lowercase letters.統計奇數位和偶數位的個字符出現的次數,若是 S0
串和 S1
串統計的結果相同,則它們是 special-equivalent 的。
符合上面兩個條件的是一組。
參考:https://blog.csdn.net/g_r_c/article/details/82079678
unordered_set使用方法
.find() 返回一個迭代器。這個迭代器指向和參數哈希值匹配的元素,若是沒有匹配的元素,會返回這個容器的結束迭代器。 .end() 返回指向容器末尾位置的迭代器 .insert() 插入元素
視頻:
https://www.youtube.com/watch?v=WJ4NtyrakT0&feature=youtu.be
圖片示例:
C++實現代碼:
#include "pch.h" #include <iostream> #include <string> #include <vector> #include <unordered_set> #include <algorithm> using std::vector; using std::string; using std::unordered_set; class Solution { public: int numSpecialEquivGroups(vector<string>& A) { unordered_set<string> st; for (int i = 0; i < A.size(); ++i) { string odd = ""; string even = ""; for (int j = 0; j < A[i].size(); ++j) { // 奇偶位的值 if (j % 2 == 0) odd += A[i][j]; else even += A[i][j]; } // 排序奇偶位的值 sort(odd.begin(), odd.end()); sort(even.begin(), even.end()); st.insert(odd + even); } return st.size(); } }; int main() { Solution solution; vector<string> A1 = { "abcd", "cdab", "adcb", "cbad" }; vector<string> A2 = { "abc", "acb", "bac", "bca", "cab", "cba" }; int res1 = solution.numSpecialEquivGroups(A1); int res2 = solution.numSpecialEquivGroups(A2); }
Python實現:
def numSpecialEquivGroups(self,A): s = set() for w in A: even = ''.join(sorted(w[0::2])) odd = ''.join(sorted(w[1::2])) s.add(odd+even) return len(s)
https://medium.com/@riccardo.ancarani94/attacking-docker-exposed-api-3e01ffc3c124
攻擊開放在互聯網的Docker API
Docker API外放有什麼危害?
【漏洞挖掘】攻擊對外開放的Docker API接口
https://www.cnblogs.com/17bdw/p/10302045.html
在這篇文章中,研究了Docker相關的威脅。讓Docker API暴露於互聯網可能會致使數據丟失,加密,僵屍網絡等問題
應急響應查找未知遠控木馬。
未知遠控進程過多,手動排查效率過低。
經過監控DNS請求,查找進程內存中的惡意C2,定位到進程
核心掃描功能經過Yara實現
入門程序員
編程技巧方面 編程語言方面 操做系統 網絡協議 數據庫設計 前端方面 字符編碼方面
一、Java 是全部語言裏面綜合實力最強的。 二、只有像 C、C++ 和 Java 這樣的靜態語言纔可讓你真正地進階。 三、對於一個合格的程序員,掌握幾門語言是很是正常的事情。一方面,這會讓你對不一樣的語言進行比較,讓你有更多的思考。另外一方面,這也是一種學習能力的培養,會讓你對於將來的新技術學習得更快。
編程的 IDE 版本管理工具 調試前端程序 數據庫設計工具
極客時間-左耳聽風-程序員練級攻略-正式入門
https://www.cnblogs.com/17bdw/p/10303352.html
正式入門