Title Description
Find the first character that appears only once in a string (0< = string length < = 10000, all made up of letters) and return its position, if not – 1 (case sensitive)
thinking
Traversing the string, find the value of the first count count 1 and return its subscript value.
Answer
class Solution:
def FirstNotRepeatingChar(self, s):
# write code here
if not s or len(s)>10000:
return -1
else:
for i in s:
if s.count(i) == 1:
return s.index(i)
I. what is an interface?
Interface testing is mainly used to define specific interaction points between external systems and systems as well as between internal subsystems, and then through these interaction points, through a number of special rules, that is, protocols, to interact between data.
Two. What types of interfaces are there?
Interfaces are generally divided into two categories:
1.Internal interface of program
2.System external interface
System external interface: for example, if you want to get resources or information from other websites or servers, others will not share the dat...
85branch
1 #include<iostream>
2 #include<cstdio>
3 #include<queue>
4 #include<cmath>
5 using namespace std;
6 typedef long long ll;
7 typedef pair<ll,int>pii;
8 const int maxn=1e5+7;
9 const int maxm=7*1e6+7;
10 priority_queue<int>q;
11 int n,m,qq,u,v,t;
12 int pup_top,lat_top;
13 ll a[maxn],pup[maxm],lat[maxn];
14 double p;
15 int main(){
16 cin>>n>>m>>qq>>u>>v>>t;
17 p=(double)u/v;
18 for(int i=1;i<=n;i++){
19 cin>>a[i];
20 q.push(a[i]);
21 }
22 for(int i=1;i<=m...
1.Definition
2.test questions
Title Description
Please implement a function to find out the first character in the character stream. For example, when the first two characters “go” are read out from a character stream, the first character that appears only once is “g”. When the first six characters “Google” are read from the character stream, the first word appears only once.The symbol is “L”. If the current character stream does not exist once, it returns the character.
thinking
It’s similar to the character that only appears once in the preceding string, but not the...
Title Description
In an integer array, except for two numbers, all other numbers appear even numbers. Please write the program to find out the two numbers that appear only once.
thinking
Similar to the first occurrence of a unique character in that string, Baidu used count counting; in addition, Baidu found that it could also use the Counter method of the collection module to compose a dictionary of list values and corresponding numbers.
Method 1:
class Solution:
# Return to [a, b], where AB is the two number that appears at a time.
def FindNumsAppearOnce(self, array):
# w...
study from:
https://blog.csdn.net/A_Comme_Amour/article/details/79356220
1.
Edmonds-Karp No optimization
1 #include <cstdio>
2 #include <cstdlib>
3 #include <cmath>
4 #include <cstring>
5 #include <time.h>
6 #include <string>
7 #include <set>
8 #include <map>
9 #include <list>
10 #include <stack>
11 #include <queue>
12 #include <vector>
13 #include <bitset>
14 #include <ext/rope>
15 #include <algorithm>
16 #include <iostream>
17 using namespace std;
18 #define ll...