LeetCode代码日记(六) 高级数据结构篇——线段树&树状数组源自LeetCode每日一题2023-11-13 LeetCode406: 根据身高重建队列打着树状妆数组tag的脑筋急转弯: 12345678public int[][] reconstructQueue(int[][] people) { Arrays.sort(people, (o1, o2)-> o1[0] == o2[0] 2023-11-13 Leetcode #代码练习日记
AI后门日记(一) 防御方法专题Detecting AI Trojans Using Meta Neural Analysis(MNTD)论文源自2021IEEE S&P,该论文提出了元神经分析检测人工智能木马,该检测方法将待检测对象视为一个黑盒,只需要投喂一定的输入,根据输出的结果就可以判别是否含有后门。因此,该方法可以无视后门类型,数据集类型等,具有一定的普适性。 其检测步骤如下: (1) Sha 2023-11-12 AI训练营 #AI后门攻防训练
LeetCode代码日记(五) 图论首次学习企划LeetCode797: 所有可能路径图论开始的第一道题,dfs经典作品: 12345678910111213141516171819private List<List<Integer>> result = new ArrayList<>(); private LinkedList<Integer> path = new Li 2023-11-08 Leetcode #代码练习日记
elasticsearch es的应用场景: Github的代码搜索/搜索引擎/电商网站搜索商品。/日志和事件数据分析 倒排索引: 倒排索引的概念是基于MySQL这样的正向索引而言的。对于Mysql中的主键,查询当然是走索引,所以是O(1)的,但是对于模糊字段查询,比如手机型号,就需要逐行扫描,此时时间复杂度变为O(n),对于超大型表格,这显然是不可以接受的。 倒排索引中两个较为重要的概 2023-11-05 SpringCloud #微服务重启计划
LeetCode每日一题 2023-11-05 LeetCode187: 重复的DNA序列字符串+去重+滑动窗口 因为s.substring的时间复杂度为O(n),频繁调用会影响效率,所以采用hashmap 12345678910111213141516171819202122232425public List<String> findRepeatedDnaSequences(String s) 2023-11-05 Leetcode #代码练习日记
LeetCode日记(四) 动态规划LeetCode62: 不同路径Ⅱ1234567891011121314151617181920212223public int uniquePathsWithObstacles(int[][] obstacleGrid) { int m = obstacleGrid.length, n = obstacleGrid[0].length; int[][ 2023-10-31 Leetcode #代码练习日记
Leetcode日记(三) 二叉树在开始二叉树之前,我们先复习两种较为少用的数据结构 Queue 和 Stack.Queue 是java.util下的一个interface,集成了collections接口,该接口有如下方法: add()/offer(): 用于向队尾添加数据, 区别: 添加失败时add方法throw异常 offer return false remove()/poll(): 用于从队头 2023-10-28 Leetcode #代码练习日记
Leetcode日记(二) 贪心算法LeetCode376: 最长摆动序列动态规划:每次选取最大值: 123456789101112131415161718192021222324252627282930313233343536public int wiggleMaxLength(int[] nums) { if (nums.length == 1) return 1; int las 2023-10-19 Leetcode #代码练习日记
Leetcode日记 双指针问题:LeetCode27: 移除元素一道快慢指针类问题: 12345678910public int removeElement(int[] nums, int val) { int slowindex = 0, fastindex = 0; for (; fastindex < nums.length; fastindex++) { i 2023-10-16 Leetcode #代码练习日记