当前位置: 首页 > news >正文

我的算法刷题笔记(3.18-3.22)

我的算法刷题笔记(3.18-3.22)

    • 1. 螺旋矩阵
        • 1. total是总共走的步数
        • 2. int[][] directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};方位
        • 3. visited[row][column] = true;用于判断是否走完一圈
    • 2. 生命游戏
        • 1. 使用额外的状态2
        • 2. 再复制一份数组
    • 3. 旋转图像
        • 观察规律,只需四分之一
    • 4. 矩阵置零
        • 1. 用第一列存储状态,但是需要从后往前
    • 5. 有效的括号
        • 1. Map存储 put('{','}'); put('[',']'); put('(',')'); put('?','?')
    • 6. 二叉树的中序遍历
    • 7. 移掉 K 位数字
        • 用12345 54321 15324 作为找规律
    • 8. 去除重复字母
        • 先拼接到答案,看后面逻辑是否回删
        • 如何遇到重复,那么跳过即可
    • 9. 字符串中的第一个唯一字符
    • 10. 最近的请求次数
    • 11. 数组中的第K个最大元素
        • 1. 小根堆创建
        • 前k个入队列,然后与剩下的对比
    • 12. 查找和最小的 K 对数字
        • 堆中的第一个元素一定是答案
    • 13. 丑数Ⅱ
    • 14. 删除有序数组中的重复项
    • 15.下一个排列
    • 16. 合并两个有序数组
    • 17. 轮转数组
    • 18. 比较版本号
    • 19. 验证回文串
    • 20. 重复的DNA序列
    • 21. 找到 K 个最接近的元素
    • 22. 两数相加
    • 23. 旋转链表
    • 24. 删除排序链表中的重复元素 II
    • 25. 反转链表 II
    • 26. 两两交换链表中的节点
    • 27. 重排链表
    • 28. 相交链表
    • 29. 存在重复元素 II

1. 螺旋矩阵

原题链接

1. total是总共走的步数
2. int[][] directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};方位
3. visited[row][column] = true;用于判断是否走完一圈
class Solution {public List<Integer> spiralOrder(int[][] matrix) {List<Integer> order = new ArrayList<Integer>();if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {return order;}int rows = matrix.length, columns = matrix[0].length;boolean[][] visited = new boolean[rows][columns];int total = rows * columns;int row = 0, column = 0;int[][] directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};int directionIndex = 0;for (int i = 0; i < total; i++) {order.add(matrix[row][column]);visited[row][column] = true;int nextRow = row + directions[directionIndex][0], nextColumn = column + directions[directionIndex][1];if (nextRow < 0 || nextRow >= rows || nextColumn < 0 || nextColumn >= columns || visited[nextRow][nextColumn]) {directionIndex = (directionIndex + 1) % 4;}row += directions[directionIndex][0];column += directions[directionIndex][1];}return order;}
}

2. 生命游戏

原题链接

1. 使用额外的状态2
class Solution {public void gameOfLife(int[][] board) {int[] neighbors = {0, 1, -1};int rows = board.length;int cols = board[0].length;// 遍历面板每一个格子里的细胞for (int row = 0; row < rows; row++) {for (int col = 0; col < cols; col++) {// 对于每一个细胞统计其八个相邻位置里的活细胞数量int liveNeighbors = 0;for (int i = 0; i < 3; i++) {for (int j = 0; j < 3; j++) {if (!(neighbors[i] == 0 && neighbors[j] == 0)) {// 相邻位置的坐标int r = (row + neighbors[i]);int c = (col + neighbors[j]);// 查看相邻的细胞是否是活细胞if ((r < rows && r >= 0) && (c < cols && c >= 0) && (Math.abs(board[r][c]) == 1)) {liveNeighbors += 1;}}}}// 规则 1 或规则 3 if ((board[row][col] == 1) && (liveNeighbors < 2 || liveNeighbors > 3)) {// -1 代表这个细胞过去是活的现在死了board[row][col] = -1;}// 规则 4if (board[row][col] == 0 && liveNeighbors == 3) {// 2 代表这个细胞过去是死的现在活了board[row][col] = 2;}}}// 遍历 board 得到一次更新后的状态for (int row = 0; row < rows; row++) {for (int col = 0; col < cols; col++) {if (board[row][col] > 0) {board[row][col] = 1;} else {board[row][col] = 0;}}}}
}作者:力扣官方题解
链接:https://leetcode.cn/problems/game-of-life/solutions/179750/sheng-ming-you-xi-by-leetcode-solution/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
2. 再复制一份数组
class Solution {public void gameOfLife(int[][] board) {int[] neighbors = {0, 1, -1};int rows = board.length;int cols = board[0].length;// 创建复制数组 copyBoardint[][] copyBoard = new int[rows][cols];// 从原数组复制一份到 copyBoard 中for (int row = 0; row < rows; row++) {for (int col = 0; col < cols; col++) {copyBoard[row][col] = board[row][col];}}// 遍历面板每一个格子里的细胞for (int row = 0; row < rows; row++) {for (int col = 0; col < cols; col++) {// 对于每一个细胞统计其八个相邻位置里的活细胞数量int liveNeighbors = 0;for (int i = 0; i < 3; i++) {for (int j = 0; j < 3; j++) {if (!(neighbors[i] == 0 && neighbors[j] == 0)) {int r = (row + neighbors[i]);int c = (col + neighbors[j]);// 查看相邻的细胞是否是活细胞if ((r < rows && r >= 0) && (c < cols && c >= 0) && (copyBoard[r][c] == 1)) {liveNeighbors += 1;}}}}// 规则 1 或规则 3      if ((copyBoard[row][col] == 1) && (liveNeighbors < 2 || liveNeighbors > 3)) {board[row][col] = 0;}// 规则 4if (copyBoard[row][col] == 0 && liveNeighbors == 3) {board[row][col] = 1;}}}}
}

3. 旋转图像

原题链接

观察规律,只需四分之一
class Solution {public void rotate(int[][] matrix) {int n = matrix.length;for (int i = 0; i < n / 2; ++i) {for (int j = 0; j < (n + 1) / 2; ++j) {int temp = matrix[i][j];matrix[i][j] = matrix[n - j - 1][i];matrix[n - j - 1][i] = matrix[n - i - 1][n - j - 1];matrix[n - i - 1][n - j - 1] = matrix[j][n - i - 1];matrix[j][n - i - 1] = temp;}}}
}

4. 矩阵置零

1. 用第一列存储状态,但是需要从后往前

原题链接

class Solution {public void setZeroes(int[][] matrix) {int m = matrix.length, n = matrix[0].length;boolean flagCol0 = false;for (int i = 0; i < m; i++) {if (matrix[i][0] == 0) {flagCol0 = true;}for (int j = 1; j < n; j++) {if (matrix[i][j] == 0) {matrix[i][0] = matrix[0][j] = 0;}}}for (int i = m - 1; i >= 0; i--) {for (int j = 1; j < n; j++) {if (matrix[i][0] == 0 || matrix[0][j] == 0) {matrix[i][j] = 0;}}if (flagCol0) {matrix[i][0] = 0;}}}
}

5. 有效的括号

1. Map存储 put(‘{’,‘}’); put(‘[’,‘]’); put(‘(’,‘)’); put(‘?’,‘?’)

原题链接

class Solution {private static final Map<Character,Character> map = new HashMap<Character,Character>(){{put('{','}'); put('[',']'); put('(',')'); }};public boolean isValid(String s) {if(s.length() > 0 && !map.containsKey(s.charAt(0))) return false;Stack<Character> stack = new Stack<Character>(){};for(Character c : s.toCharArray()){if(map.containsKey(c)) stack.add(c);else if(stack.isEmpty() == true || map.get(stack.pop()) != c) return false;}return stack.size() == 0;}
}

6. 二叉树的中序遍历

class Solution {public List<Integer> inorderTraversal(TreeNode root) {List<Integer> res = new ArrayList<Integer>();inorder(root, res);return res;}public void inorder(TreeNode root, List<Integer> res) {if (root == null) {return;}inorder(root.left, res);res.add(root.val);inorder(root.right, res);}
}

7. 移掉 K 位数字

用12345 54321 15324 作为找规律

原题链接


class Solution {
class Solution {public String removeKdigits(String num, int k) {Deque<Character> stk = new ArrayDeque<>();for (char c : num.toCharArray()) {while (!stk.isEmpty() && c < stk.getLast() && k > 0) {stk.pollLast();k--;}stk.addLast(c);}String res = stk.stream().map(Object::toString).collect(Collectors.joining());res = res.substring(0, res.length() - k).replaceAll("^0+", "");return res.isEmpty() ? "0" : res;}
}

8. 去除重复字母

先拼接到答案,看后面逻辑是否回删
如何遇到重复,那么跳过即可

原题链接

class Solution {public String removeDuplicateLetters(String S) {char[] s = S.toCharArray();int[] left = new int[26];for (char c : s)left[c - 'a']++; // 统计每个字母的出现次数StringBuilder ans = new StringBuilder(26);boolean[] inAns = new boolean[26];for (char c : s) {left[c - 'a']--;if (inAns[c - 'a']) // ans 中不能有重复字母continue;// 设 x = ans.charAt(ans.length() - 1),// 如果 c < x,且右边还有 x,那么可以把 x 去掉,因为后面可以重新把 x 加到 ans 中while (!ans.isEmpty() && c < ans.charAt(ans.length() - 1) && left[ans.charAt(ans.length() - 1) - 'a'] > 0) {inAns[ans.charAt(ans.length() - 1) - 'a'] = false; // 标记 x 不在 ans 中ans.deleteCharAt(ans.length() - 1);}ans.append(c); // 把 c 加到 ans 的末尾inAns[c - 'a'] = true; // 标记 c 在 ans 中}return ans.toString();}
}

9. 字符串中的第一个唯一字符

原题链接

class Solution {public int firstUniqChar(String s) {Map<Character,Integer> frequency = new HashMap<>();for (int i = 0; i < s.length(); i++) {char ch = s.charAt(i);frequency.put(ch, frequency.getOrDefault(ch,0)+1);}for (int i = 0; i < s.length(); i++) {if (frequency.get(s.charAt(i)) == 1) {return i;}}return -1;}
}

10. 最近的请求次数

原题链接

class RecentCounter {Queue<Integer> queue;public RecentCounter() {queue = new ArrayDeque<Integer>();}public int ping(int t) {queue.offer(t);while (queue.peek() < t - 3000) {queue.poll();}return queue.size();}
}

11. 数组中的第K个最大元素

原题链接

1. 小根堆创建
前k个入队列,然后与剩下的对比
class Solution {public int findKthLargest(int[] nums, int k) {// 初始化小顶堆Queue<Integer> heap = new PriorityQueue<>((o1,o2) -> o2 - o1);// 将数组的前k个元素入堆for (int i = 0; i < nums.length; i++) {heap.offer(nums[i]);}// 从第k + 1个元素开始与堆顶元素比较// 若大于堆顶元素则将其入堆,并将当前堆顶元素出堆for (int i = 0; i < k-1; i++) {heap.poll();}return heap.peek();}
}

12. 查找和最小的 K 对数字

堆中的第一个元素一定是答案

原题链接

class Solution {public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {int n = nums1.length, m = nums2.length;var ans = new ArrayList<List<Integer>>();var pq = new PriorityQueue<int[]>((a, b) -> a[0] - b[0]);for (int i = 0; i < Math.min(n, k); i++) // 至多 k 个pq.add(new int[]{nums1[i] + nums2[0], i, 0});while (!pq.isEmpty() && ans.size() < k) {var p = pq.poll();int i = p[1], j = p[2];ans.add(List.of(nums1[i], nums2[j]));if (j + 1 < m)pq.add(new int[]{nums1[i] + nums2[j + 1], i, j + 1});}return ans;}
}

13. 丑数Ⅱ

原题链接

class Solution {public int nthUglyNumber(int n) {int[] factors = {2, 3, 5};Set<Long> seen = new HashSet<Long>();PriorityQueue<Long> heap = new PriorityQueue<Long>();seen.add(1L);heap.offer(1L);int ugly = 0;for (int i = 0; i < n; i++) {long curr = heap.poll();ugly = (int) curr;for (int factor : factors) {long next = curr * factor;if (seen.add(next)) {heap.offer(next);}}}return ugly;}
}

14. 删除有序数组中的重复项

原题链接

class Solution {public int removeDuplicates(int[] nums) {if(nums == null || nums.length == 0) return 0;int p = 0;int q = 1;while(q < nums.length){if(nums[p] != nums[q]){nums[p + 1] = nums[q];p++;}q++;}return p + 1;}
}

15.下一个排列

下一个排列

class Solution {public void nextPermutation(int[] nums) {if (nums == null || nums.length == 0) return;int firstIndex = -1;for (int i = nums.length - 2; i >= 0; i--) {if (nums[i] < nums[i + 1]) {firstIndex = i;break;}}if (firstIndex == -1) {reverse(nums, 0, nums.length - 1);return;}int secondIndex = -1;for (int i = nums.length - 1; i >= 0; i--) {if (nums[i] > nums[firstIndex]) {secondIndex = i;break;}}swap(nums, firstIndex, secondIndex);reverse(nums, firstIndex + 1, nums.length - 1);return;}private void reverse(int[] nums, int i, int j) {while (i < j) {swap(nums, i++, j--);}}private void swap(int[] nums, int i, int i1) {int tmp = nums[i];nums[i] = nums[i1];nums[i1] = tmp;}
}

16. 合并两个有序数组

合并两个有序数组

class Solution {public void merge(int[] nums1, int m, int[] nums2, int n) {int p1 = 0, p2 = 0;int[] sorted = new int[m + n];int cur;while (p1 < m || p2 < n) {if (p1 == m) {cur = nums2[p2++];} else if (p2 == n) {cur = nums1[p1++];} else if (nums1[p1] < nums2[p2]) {cur = nums1[p1++];} else {cur = nums2[p2++];}sorted[p1 + p2 - 1] = cur;}for (int i = 0; i != m + n; ++i) {nums1[i] = sorted[i];}}
}

17. 轮转数组

轮转数组

class Solution {public void rotate(int[] nums, int k) {k %= nums.length;reverse(nums, 0, nums.length - 1);reverse(nums, 0, k - 1);reverse(nums, k, nums.length - 1);}public void reverse(int[] nums, int start, int end) {while (start < end) {int temp = nums[start];nums[start] = nums[end];nums[end] = temp;start += 1;end -= 1;}}
}

18. 比较版本号

比较版本号

class Solution {public int compareVersion(String version1, String version2) {String[] v1 = version1.split("\\.");String[] v2 = version2.split("\\.");for (int i = 0; i < v1.length || i < v2.length; ++i) {int x = 0, y = 0;if (i < v1.length) {x = Integer.parseInt(v1[i]);}if (i < v2.length) {y = Integer.parseInt(v2[i]);}if (x > y) {return 1;}if (x < y) {return -1;}}return 0;}
}

19. 验证回文串

验证回文串

class Solution {public boolean isPalindrome(String s) {StringBuffer sgood = new StringBuffer();int length = s.length();for (int i = 0; i < length; i++) {char ch = s.charAt(i);if (Character.isLetterOrDigit(ch)) {sgood.append(Character.toLowerCase(ch));}}StringBuffer sgood_rev = new StringBuffer(sgood).reverse();return sgood.toString().equals(sgood_rev.toString());}
}

20. 重复的DNA序列

原题链接

class Solution {static final int L = 10;public List<String> findRepeatedDnaSequences(String s) {List<String> ans = new ArrayList<String>();Map<String, Integer> cnt = new HashMap<String, Integer>();int n = s.length();for (int i = 0; i <= n - L; ++i) {String sub = s.substring(i, i + L);cnt.put(sub, cnt.getOrDefault(sub, 0) + 1);if (cnt.get(sub) == 2) {ans.add(sub);}}return ans;}
}

21. 找到 K 个最接近的元素

找到 K 个最接近的元素

class Solution {public List<Integer> findClosestElements(int[] arr, int k, int x) {List<Integer> list = new ArrayList<>();int n = arr.length;int left = 0;int right = 0; int sum = 0;int res = Integer.MAX_VALUE;int idx = 0;while (right < n) {sum += Math.abs(arr[right] - x);if (right - left + 1 == k) { //固定窗口大小为kif (sum < res) {res = sum;idx = left;}sum -= Math.abs(arr[left] - x);left++;}right++;}for (int i = idx; i < idx + k; i++) {list.add(arr[i]);}return list;  }
}

22. 两数相加

原题链接

/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode() {}*     ListNode(int val) { this.val = val; }*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/
/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode(int x) { val = x; }* }*/
class Solution {public ListNode addTwoNumbers(ListNode l1, ListNode l2) {ListNode pre = new ListNode(0);ListNode cur = pre;int carry = 0;while(l1 != null || l2 != null) {int x = l1 == null ? 0 : l1.val;int y = l2 == null ? 0 : l2.val;int sum = x + y + carry;carry = sum / 10;sum = sum % 10;cur.next = new ListNode(sum);cur = cur.next;if(l1 != null)l1 = l1.next;if(l2 != null)l2 = l2.next;}if(carry == 1) {cur.next = new ListNode(carry);}return pre.next;}
}

23. 旋转链表

原题链接

 * Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode() {}*     ListNode(int val) { this.val = val; }*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/
class Solution {public ListNode rotateRight(ListNode head, int k) {if (k == 0 || head == null || head.next == null) {return head;}int n = 1;ListNode iter = head;while (iter.next != null) {iter = iter.next;n++;}int add = n - k % n;if (add == n) {return head;}iter.next = head;while (add-- > 0) {iter = iter.next;}ListNode ret = iter.next;iter.next = null;return ret;}
}

24. 删除排序链表中的重复元素 II

原题链接

class Solution {public ListNode deleteDuplicates(ListNode head) {if (head == null) {return head;}ListNode dummy = new ListNode(0, head);ListNode cur = dummy;while (cur.next != null && cur.next.next != null) {if (cur.next.val == cur.next.next.val) {int x = cur.next.val;while (cur.next != null && cur.next.val == x) {cur.next = cur.next.next;}} else {cur = cur.next;}}return dummy.next;}
}

25. 反转链表 II

原题链接

class Solution {public ListNode reverseBetween(ListNode head, int left, int right) {ListNode dummy = new ListNode(0, head), p0 = dummy;for (int i = 0; i < left - 1; ++i)p0 = p0.next;ListNode pre = null, cur = p0.next;for (int i = 0; i < right - left + 1; ++i) {ListNode nxt = cur.next;cur.next = pre; // 每次循环只修改一个 next,方便大家理解pre = cur;cur = nxt;}// 见视频p0.next.next = cur;p0.next = pre;return dummy.next;}
}

26. 两两交换链表中的节点

原题链接

class Solution {public ListNode swapPairs(ListNode head) {ListNode dummyHead = new ListNode(0);dummyHead.next = head;ListNode temp = dummyHead;while (temp.next != null && temp.next.next != null) {ListNode node1 = temp.next;ListNode node2 = temp.next.next;temp.next = node2;node1.next = node2.next;node2.next = node1;temp = node1;}return dummyHead.next;}
}

27. 重排链表

重排链表

class Solution {public void reorderList(ListNode head) {if (head == null) {return;}List<ListNode> list = new ArrayList<ListNode>();ListNode node = head;while (node != null) {list.add(node);node = node.next;}int i = 0, j = list.size() - 1;while (i < j) {list.get(i).next = list.get(j);i++;if (i == j) {break;}list.get(j).next = list.get(i);j--;}list.get(i).next = null;}
}

28. 相交链表

原题链接

/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode(int x) {*         val = x;*         next = null;*     }* }*/
public class Solution {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {if (headA == null || headB == null) return null;ListNode pA = headA, pB = headB;while (pA != pB) {pA = pA == null ? headB : pA.next;pB = pB == null ? headA : pB.next;}return pA;
}}

29. 存在重复元素 II

原题链接

class Solution {public boolean containsNearbyDuplicate(int[] nums, int k) {Map<Integer, Integer> map = new HashMap<Integer, Integer>();int length = nums.length;for (int i = 0; i < length; i++) {int num = nums[i];if (map.containsKey(num) && i - map.get(num) <= k) {return true;}map.put(num, i);}return false;}
}

相关文章:

我的算法刷题笔记(3.18-3.22)

我的算法刷题笔记&#xff08;3.18-3.22&#xff09; 1. 螺旋矩阵1. total是总共走的步数2. int[][] directions {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};方位3. visited[row][column] true;用于判断是否走完一圈 2. 生命游戏1. 使用额外的状态22. 再复制一份数组 3. 旋转图像观…...

初探Ruby编程语言

文章目录 引言一、Ruby简史二、Ruby特性三、安装Ruby四、命令行执行Ruby五、Ruby的编程模型六、案例演示结语 引言 大家好&#xff0c;今天我们将一起探索一门历史悠久、充满魅力的编程语言——Ruby。Ruby是由松本行弘&#xff08;Yukihiro Matsumoto&#xff09;于1993年发明…...

深圳MES系统如何提高生产效率

深圳MES系统可以通过多种方式提高生产效率&#xff0c;具体如下&#xff1a; 实时监控和分析&#xff1a;MES系统可以实时收集并分析生产数据&#xff0c;帮助企业及时了解生产状况&#xff0c;发现问题并迅速解决&#xff0c;避免问题扩大化。这种实时监控和分析功能可以显著…...

QT常见Layout布局器使用

布局简介 为什么要布局&#xff1f;通过布局拖动不影响鼠标拖动窗口的效果等优点.QT设计器布局比较固定&#xff0c;不方便后期修改和维护&#xff1b;在Qt里面布局分为四个大类 &#xff1a; 盒子布局&#xff1a;QBoxLayout 网格布局&#xff1a;QGridLayout 表单布局&am…...

Elasticsearch8 - Docker安装Elasticsearch8.12.2

前言 最近在学习 ES&#xff0c;所以需要在服务器上装一个单节点的 ES 服务器环境&#xff1a;centos 7.9 安装 下载镜像 目前最新版本是 8.12.2 docker pull docker.elastic.co/elasticsearch/elasticsearch:8.12.2创建配置 新增配置文件 elasticsearch.yml http.host…...

还在为不知道怎么学习网络安全而烦恼吗?这篇文带你从入门级开始学习网络安全—认识网络安全

随着网络安全被列为国家安全战略的一部分&#xff0c;这个曾经细分的领域发展提速了不少&#xff0c;除了一些传统安全厂商以外&#xff0c;一些互联网大厂也都纷纷加码了在这一块的投入&#xff0c;随之而来的吸引了越来越多的新鲜血液不断涌入。 不同于Java、C/C等后端开发岗…...

DFS基础——迷宫

迷宫 配套视频讲解 关于dfs和bfs的区别讲解。 对于上图&#xff0c;假设我们要找从1到5的最短路&#xff0c;那么我们用dfs去找&#xff0c;并且按照编号从大到小的顺序去找&#xff0c;首先找到的路径如下&#xff0c; 从节点1出发&#xff0c;我们发现节点2可以走&#xff…...

iOS开发进阶(九):OC混合开发嵌套H5应用并互相通信

文章目录 一、前言二、嵌套H5应用并实现双方通信2.1 WKWebView 与JS 原生交互2.1.1 H5页面嵌套2.1.2 常用代理方法2.1.3 OC调用JS方法2.1.4 JS调用OC方法 2.2 JSCore 实现原生与H5交互2.2.1 OC调用H5方法并传参2.2.2 H5给OC传参 2.3 UIWebView的基本用法2.3.1 H5页面嵌套2.3.2 …...

新人应该从哪几个方面掌握大数据测试?

什么是大数据 大数据是指无法在一定时间范围内用传统的计算机技术进行处理的海量数据集。 对于大数据的测试则需要不同的工具、技术、框架来进行处理。 大数据的体量大、多样化和高速处理所涉及的数据生成、存储、检索和分析使得大数据工程师需要掌握极其高的技术功底。 需要你…...

linux debian运行pip报错ssl tsl module in Python is not available

写在前面 ① 在debian 8上升级了Python 3.8.5 ② 升级了openssl 1.1.1 问题描述 在运行pip命令时提示如下错误 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.尝试了大神推荐的用如下方法重新编译安装python,发…...

宝塔设置限制ip后,ip改了之后 ,登陆不上了

前言 今天作死&#xff0c;在宝塔面板设置界面&#xff0c;将访问面板的ip地址限制成只有自己电脑的ip才能访问&#xff0c;修改之后直接人傻了&#xff0c;“403 forbidden”。吓得我直接网上一通搜索&#xff0c;还好&#xff0c;解决方法非常简单。 解决方法 打开ssh客户…...

解锁新功能,Dynadot现支持BITPAY平台虚拟货币

Dynadot现已支持虚拟货币付款&#xff01;借助与BitPay平台的合作&#xff0c;Dynadot为您提供了多种安全的虚拟货币选择。我们深知每位客户都有自己偏好的支付方式&#xff0c;因此我们努力扩大了支付方式范围。如果您对这一新的支付方式感兴趣&#xff0c;在结账时您可以尝试…...

Android下的Touch事件分发详解

文章目录 一、事件传递路径二、触摸事件的三个关键方法2.1 dispatchTouchEvent(MotionEvent ev)2.2 onInterceptTouchEvent(MotionEvent ev)2.3 onTouchEvent(MotionEvent event) 三、ViewGroup中的dispatchTouchEvent实现四、总结 在Android系统中&#xff0c;触摸事件的分发和…...

uniapp的配置文件、入口文件、主组件、页面管理部分

pages.json 配置文件&#xff0c;全局页面路径配置&#xff0c;应用的状态栏、导航条、标题、窗口背景色设置等 main.js 入口文件&#xff0c;主要作用是初始化vue实例、定义全局组件、使用需要的插件如 vuex&#xff0c;注意uniapp无法使用vue-router&#xff0c;路由须在pag…...

B端设计:如何让UI组件库成为助力,而不是阻力。

首发2023-09-24 15:42贝格前端工场 Hi&#xff0c;我是大千UI工场&#xff0c;网上的UI组件库琳琅满目&#xff0c;比如elementUI、antdesign、iview等等&#xff0c;甚至很多前端框架&#xff0c;也出了很多UI组件&#xff0c;如若依、Layui、bootstrap等等&#xff0c;作为U…...

敏捷开发最佳实践:学习与改进维度实践案例之会诊式培养敏捷教练

自组织团队能够定期反思并采取针对性行动来提升人效&#xff0c;但2022年的敏捷调研发现&#xff0c;70%的中国企业在学习和改进方面仍停留在团队级。本节实践案例将分享“会诊式培养敏捷教练”的具体做法&#xff0c;突出了敏捷以人为本的学习和改进&#xff0c;强调了通过人员…...

C#宿舍信息管理系统

简介 功能 1.发布公告 2.地理信息与天气信息的弹窗 3.学生信息的增删改查 4.宿舍信息的增删改查 5.管理员信息的增删改查 6.学生对宿舍物品的报修与核实 7.学生提交请假与销假 8.管理员对保修的审批 9.管理员对请假的审批 技术 1.采用C#\Winform开发的C\S系统 2.采用MD5对数据…...

测试环境搭建整套大数据系统(十三:设置开机自启动)

一&#xff1a;编写程序启动命令脚本 vim /root/start.sh二&#xff1a;编写启动脚本 cd /etc/systemd/system vim start.service[Unit] DescriptionStart My Server Afternetwork.target[Service] Typeforking ExecStart/root/start start TimeoutSec0 RemainafterExityes G…...

算法练习第三十二天|122.买卖股票的最佳时机II、55. 跳跃游戏、45.跳跃游戏II

45. 跳跃游戏 II 55. 跳跃游戏 122.买卖股票的最佳时机II 122.买卖股票的最佳时机II class Solution {public int maxProfit(int[] prices) {int result 0;for(int i 1;i<prices.length;i){result Math.max(prices[i] - prices[i-1],0);}return result;} }跳跃游戏 cla…...

nodejs+vue反诈科普平台的设计与实现pythonflask-django-php

相比于以前的传统手工管理方式&#xff0c;智能化的管理方式可以大幅降低反诈科普平台的运营人员成本&#xff0c;实现了反诈科普平台的标准化、制度化、程序化的管理&#xff0c;有效地防止了反诈科普平台的随意管理&#xff0c;提高了信息的处理速度和精确度&#xff0c;能够…...

大数据学习栈记——Neo4j的安装与使用

本文介绍图数据库Neofj的安装与使用&#xff0c;操作系统&#xff1a;Ubuntu24.04&#xff0c;Neofj版本&#xff1a;2025.04.0。 Apt安装 Neofj可以进行官网安装&#xff1a;Neo4j Deployment Center - Graph Database & Analytics 我这里安装是添加软件源的方法 最新版…...

Lombok 的 @Data 注解失效,未生成 getter/setter 方法引发的HTTP 406 错误

HTTP 状态码 406 (Not Acceptable) 和 500 (Internal Server Error) 是两类完全不同的错误&#xff0c;它们的含义、原因和解决方法都有显著区别。以下是详细对比&#xff1a; 1. HTTP 406 (Not Acceptable) 含义&#xff1a; 客户端请求的内容类型与服务器支持的内容类型不匹…...

【WiFi帧结构】

文章目录 帧结构MAC头部管理帧 帧结构 Wi-Fi的帧分为三部分组成&#xff1a;MAC头部frame bodyFCS&#xff0c;其中MAC是固定格式的&#xff0c;frame body是可变长度。 MAC头部有frame control&#xff0c;duration&#xff0c;address1&#xff0c;address2&#xff0c;addre…...

DAY 47

三、通道注意力 3.1 通道注意力的定义 # 新增&#xff1a;通道注意力模块&#xff08;SE模块&#xff09; class ChannelAttention(nn.Module):"""通道注意力模块(Squeeze-and-Excitation)"""def __init__(self, in_channels, reduction_rat…...

Psychopy音频的使用

Psychopy音频的使用 本文主要解决以下问题&#xff1a; 指定音频引擎与设备&#xff1b;播放音频文件 本文所使用的环境&#xff1a; Python3.10 numpy2.2.6 psychopy2025.1.1 psychtoolbox3.0.19.14 一、音频配置 Psychopy文档链接为Sound - for audio playback — Psy…...

CRMEB 框架中 PHP 上传扩展开发:涵盖本地上传及阿里云 OSS、腾讯云 COS、七牛云

目前已有本地上传、阿里云OSS上传、腾讯云COS上传、七牛云上传扩展 扩展入口文件 文件目录 crmeb\services\upload\Upload.php namespace crmeb\services\upload;use crmeb\basic\BaseManager; use think\facade\Config;/*** Class Upload* package crmeb\services\upload* …...

SpringCloudGateway 自定义局部过滤器

场景&#xff1a; 将所有请求转化为同一路径请求&#xff08;方便穿网配置&#xff09;在请求头内标识原来路径&#xff0c;然后在将请求分发给不同服务 AllToOneGatewayFilterFactory import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; impor…...

有限自动机到正规文法转换器v1.0

1 项目简介 这是一个功能强大的有限自动机&#xff08;Finite Automaton, FA&#xff09;到正规文法&#xff08;Regular Grammar&#xff09;转换器&#xff0c;它配备了一个直观且完整的图形用户界面&#xff0c;使用户能够轻松地进行操作和观察。该程序基于编译原理中的经典…...

OPENCV形态学基础之二腐蚀

一.腐蚀的原理 (图1) 数学表达式&#xff1a;dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一&#xff0c;腐蚀跟膨胀属于反向操作&#xff0c;膨胀是把图像图像变大&#xff0c;而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...

Mobile ALOHA全身模仿学习

一、题目 Mobile ALOHA&#xff1a;通过低成本全身远程操作学习双手移动操作 传统模仿学习&#xff08;Imitation Learning&#xff09;缺点&#xff1a;聚焦与桌面操作&#xff0c;缺乏通用任务所需的移动性和灵活性 本论文优点&#xff1a;&#xff08;1&#xff09;在ALOHA…...