![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
普通网友
这个作者很懒,什么都没留下…
展开
-
leetcode刷题之路-47. 全排列 II
class Solution { public List<List<Integer>> permuteUnique(int[] nums) { // 排序 Arrays.sort(nums); List<List<Integer>> res = new ArrayList<>(); int[] visited = new int[nums.length]; dfs原创 2021-01-06 22:59:17 · 91 阅读 · 0 评论 -
Leetcode刷题之路-12. 整数转罗马数字
https://leetcode-cn.com/problems/integer-to-roman/ public class Solution { public String intToRoman(int num) { // 把阿拉伯数字与罗马数字可能出现的所有情况和对应关系,放在两个数组中,并且按照阿拉伯数字的大小降序排列 int[] nums = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};原创 2020-12-16 00:08:09 · 95 阅读 · 0 评论 -
Leetcode刷题之路-11. 盛最多水的容器
https://leetcode-cn.com/problems/container-with-most-water/ class Solution { public int maxArea(int[] height) { int max = 0; for(int i=0,j=height.length-1;i<j;){ int h = height[i] < height[j] ? height[i++]:height[j--];原创 2020-12-15 23:54:58 · 82 阅读 · 0 评论 -
Leetcode刷题之路-283.移动零
https://leetcode-cn.com/problems/move-zeroes/ class Solution { public void moveZeroes(int[] nums) { int j=0; //以为j永远记录的是 下一个非0元素要放的位置 for(int i=0;i<nums.length;++i){ if(nums[i] != 0){ nums[j] = nums[i];原创 2020-12-15 23:50:04 · 99 阅读 · 1 评论