遇见YY

导航

 

2020年8月14日

摘要: 给定一个可能包含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 LeetCode:https://leetcode-cn.com/problems/subsets-ii public class Main { public static void m 阅读全文
posted @ 2020-08-14 20:29 一骑红尘妃子笑! 阅读(184) 评论(0) 推荐(0)
 
摘要: 十进制(N) 自然二进制B(N) 典型格雷码G(N) 0 000 000 1 001 001 2 010 011 3 011 010 4 100 110 5 101 111 6 110 101 7 111 100 典型格雷码的数学规律:G(N) = B(N)>>1 XOR B(N) public c 阅读全文
posted @ 2020-08-14 19:34 一骑红尘妃子笑! 阅读(720) 评论(0) 推荐(0)
 
摘要: 合并两个有序数组--LeetCode:https://leetcode-cn.com/problems/merge-sorted-array 题目虽然归类于简单类型,鉴于题目要求是合并到传入参数nums1,如果不从后向前进行合并的话,则要么浪费空间(一般做法是对num1拷贝一份),要么很复杂! 特此 阅读全文
posted @ 2020-08-14 17:12 一骑红尘妃子笑! 阅读(183) 评论(0) 推荐(0)
 
摘要: ArrayList转化为基本类型int数组! import java.util.ArrayList; import java.util.Random; public class Main { public static void main(String[] args) { ArrayList<Int 阅读全文
posted @ 2020-08-14 11:18 一骑红尘妃子笑! 阅读(734) 评论(0) 推荐(0)