Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. Note: T…
function getCount(str) { for(var code=32;code<128;code++){ var mych=String.fromCharCode(code); var count=0; for(var i=0;i<str.length;i++){ var ch=str.charAt(i); if(ch===mych){ count++; } } if(count>0){ console.log("字符"+mych+"出现了&qu…
题目:找出一个数组中第m小的值并输出. 代码: #include <stdio.h> int findm_min(int a[], int n, int m) //n代表数组长度,m代表找出第m小的数据 { int left, right, privot, temp; int i, j; left = 0; right = n - 1; while(left < right) { privot = a[m-1]; i = left; j = right; do { while(privo…