摘要: 338 给你一个整数 n ,对于 0 <= i <= n 中的每个 i ,计算其二进制表示中 1 的个数 ,返回一个长度为 n + 1 的数组 ans 作为答案。 class Solution { public int[] countBits(int n) { int[] res = new int 阅读全文
posted @ 2022-05-24 10:33 牵魂 阅读(22) 评论(0) 推荐(0)
摘要: 给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 请你设计并实现时间复杂度为 O(n) 的算法解决此问题。 来源:力扣(LeetCode)链接:https://leetcode.cn/problems/longest-consecutive-seq 阅读全文
posted @ 2022-05-24 10:05 牵魂 阅读(27) 评论(0) 推荐(0)