{"id":18313907,"url":"https://github.com/oeljeklaus-you/leetcode","last_synced_at":"2025-04-09T12:26:58.189Z","repository":{"id":97009601,"uuid":"139028918","full_name":"oeljeklaus-you/LeetCode","owner":"oeljeklaus-you","description":"LeetCode的Java实现","archived":false,"fork":false,"pushed_at":"2018-10-11T08:25:35.000Z","size":626,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T06:31:40.402Z","etag":null,"topics":["java","leetcode-java","leetcode-practice","leetcode-solutions"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oeljeklaus-you.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-28T14:24:40.000Z","updated_at":"2018-10-11T08:25:36.000Z","dependencies_parsed_at":"2024-03-08T16:45:49.068Z","dependency_job_id":null,"html_url":"https://github.com/oeljeklaus-you/LeetCode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oeljeklaus-you%2FLeetCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oeljeklaus-you%2FLeetCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oeljeklaus-you%2FLeetCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oeljeklaus-you%2FLeetCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oeljeklaus-you","download_url":"https://codeload.github.com/oeljeklaus-you/LeetCode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248038451,"owners_count":21037520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","leetcode-java","leetcode-practice","leetcode-solutions"],"created_at":"2024-11-05T16:29:06.818Z","updated_at":"2025-04-09T12:26:53.179Z","avatar_url":"https://github.com/oeljeklaus-you.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LeetCode刷题心得\n## 在刷题过程中，主要按照数据结构划分\n## 移动元素的解法\n1.如果要移动元素，一般是快排，\n2.如果要保持相对位置不变使用复制如题283，27\n## 链表溢出问题\n如果是要移除或者增加链表一般需要自己设置头节点，避免错误，出现移除问题\n可以将后一个节点的元素复制给这个节点如题203\n## 利用数据结构的特性求解\n### Set集合的特性\n例如LeetCode题349，求两个数组的交集，使用HasHSet求解，其实有4种方案，详细将题349\n### List集合的特性\n例如LeetCode题350,349的加强版\n## 双指针法\n### 求解倒数第k节点和删除倒数第k节点\n针对于求解倒数第k节点和删除倒数第k节点，那么将会双指针方法，可以看题19\n### 判断链表是否有环\nLeetCode题141,使用快慢指针即可，但是加强题142需要数学推理\n### 接雨水问题\nLeetCode题42,这里直接计算出两端最大值然后判断即可，具体思路见代码\n## 快慢指针法\n通过快慢指针判断题设，比较典型的题型有141，和160公共节点求解\n## 树\n### 二叉搜索树\n二叉搜索树的中序遍历是有序的，题653主要考察这个知识点是题167的变种\n### 层次遍历解决的问题\n1。leetcode题404左叶子节点的和\n### 子树\n判断一个树是否是一个树的子树或者是子结构，首先要判断各个子树即可题574\n## 字符匹配问题\n针对于字符匹配以及变种问题，一般都使用Stack数据结构来解决，可以查看题32,这是匹配问题的变种问题\n## 逆波兰表达式\n对于这一类问题，也是使用栈数据结构，求解的是操作数就进行压站，遇到操作符就出栈，弹出两个数字计算，如果不能就出错了,题150\n## 字符串\n### 字符串移动问题\n  向左移动k位等于向右移动n-k位，移动问题一般是找到翻转基准线，左边翻转，右边翻转，最后整体翻转\n### 最长公共子序列LCS\n### hash映射\n有时候题目出现全是小写或者大写的，可以使用hash映射，例如题387\n### 单词的同分异构体\nLeetCode题242,49这里主要介绍的是素数相乘\n### 树的层次遍历\n树的层次遍历的各种问题 1、树的最小深度 题111 2、是否是镜像树 题101\n## 循环不变式应用\n### 找到迷失的整数\nleetCode题268，具体解法是如果现在的值小于i或者后者大于等于数组长度舍弃，如果不等于，就将该值放在合适的位置，最后就是i++\n### 迷失的数\n较于题268，题42需要判断有重复的数 解题思路见题42\n## 旋转问题通用解法\n1。先整体翻转，2。在找到中间点，然后部分翻转。例如题189\n## 局部最值问题\n### 排序旋转数组中的最小值\nLeetCode题152 由于是排序的，最好利用排序的性质，二分法，时间复制度极小，这里要注意排除顺序与逆序的情况\n### 有重复元素的排序旋转数组中的最小值\nLeetCode题153 由于是排序的，最好利用排序的性质，二分法，时间复制度极小，这里要注意排除顺序与逆序还有就是重复元素的情况\n### 二分查找搜索\nLeetCode题81和题33，由于数组是排序的翻转，那么必然部分属于二分查找的性质，这我们需要注意的是在查找中有重复元素的出现，那么就要一个一个搜索了\n## 快速排序问题\n### 寻找第k大的数\n这里使用快速排序，快速排序将数组分位两个部分，如果前半段的元素数量比k大，那么就在前半段递归，否则在后半段递归。\n## 排列组合问题(回溯法)\n\n## 数字缺失问题\n### 数字缺失中无重复数字\n如果给定一个长度的数组，里面是连续的自然数，有缺失，解该决呢？题42\n## 动态规划问题\n### 解题总体思路\n先求初始值，然后求解转化方程式，然后求出最大值即可\n### 最长公共子序列\n题300，还有一种时间复杂度是O(nLogN)的解法\n### 最小路径和\n二阶动态规划 题64\n### 杨辉三角形\n二阶动态规划 题120\n### 不同的路径\n二阶动态规划 题62\n## 根据所给的数据特征进行编程\n### 结合数组特征，翻转数字\n题442 将定位的数组反转\n## 刷题要注意的事情\n### 为空\n对于一些数组和指针，需要判断是否为空，还有就是二维数组，防止[[]]这种情况\n### 整数溢出\n对于整数的相加、相乘、相减要防整数溢出的问题\n### 链表问题\n在没有特殊要求的情况下，可以自己定义一个含头指针的链表，这样可以避免很多错误\n例如题 2\n### 翻转问题\n字符串的处理类StringBuilder中又一个翻转函数 reverse()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foeljeklaus-you%2Fleetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foeljeklaus-you%2Fleetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foeljeklaus-you%2Fleetcode/lists"}