- 博客(5)
- 收藏
- 关注
原创 go学习笔记 控制结构:if、for、switch
if语句 i := 10 if i > 10 { fmt.Println("1") } else if i > 5 && i <= 10 { fmt.Println("3") } else { fmt.Println("2") } // if 后面加分号 if i:=6; i >10 { fmt.Println("i>10") } el
2021-01-28 21:45:26
125
原创 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
原创 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
原创 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
原创 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
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人