摘要:
题意:给定一个数组,数组的度是其中出现最多次数的元素。求,最小连续子数组的度和原数组一致。 思路:(参考最佳答案) 遍历数组,找到数组最大值,然后根据最大值设置三个长度为max+1的数组left[],right[],counts[],分别用于存储一个数第一次出现的索引、最后一次出现的索引、出现次数。 阅读全文
摘要:
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文