class Solution {
public:intfirstUniqChar(string s){int arr[130]={0};for(auto x : s){
arr[x-'0']++;}int i =0;for(auto x : s){if(arr[x-'0']==1)return i;
i++;}return-1;}};
避免落入局部最优解,只要让步长够长即可。 x1 resultX1 random1.NextDouble()*100; 如果后面不乘以100,则很大概率落入负数的最大值 Random random1 new Random(DateTime.Now.Millisecond);double x1 0, resultX10,max-999999,maxTemp0;for (int i …