摘要:
leetcode 每日一题 905. 按奇偶排序数组 class Solution { public int[] sortArrayByParity(int[] nums) { int i = 0; int j = nums.length - 1; while (i < j) { while (nu 阅读全文
摘要:
leetcode每日一题 883. 三维形体投影面积 class Solution { public int projectionArea(int[][] grid) { int sum = 0; for (int i = 0; i < grid.length; i++) { int max = 0 阅读全文
摘要:
相同概率获取元素O(n) public static void main(String[] args) { //随机获取元素为3的下标 int target = 3; Random random = new Random(); int[] arr = {1, 2, 3, 3, 3, 4, 5}; i 阅读全文
摘要:
leetcode每日一题 868. 二进制间距 class Solution { public int binaryGap(int n) { char[] arr = Integer.toBinaryString(n).toCharArray(); int[] res = new int[arr.l 阅读全文