{"id":15678061,"url":"https://github.com/tjx666/leetcode-javascript","last_synced_at":"2025-05-07T02:23:23.175Z","repository":{"id":40730110,"uuid":"232597183","full_name":"tjx666/leetcode-javascript","owner":"tjx666","description":"leetcode with javascript","archived":false,"fork":false,"pushed_at":"2022-06-25T09:56:14.000Z","size":829,"stargazers_count":12,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T07:38:20.380Z","etag":null,"topics":["javascript","leetcode"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tjx666.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}},"created_at":"2020-01-08T15:41:21.000Z","updated_at":"2021-09-28T08:13:08.000Z","dependencies_parsed_at":"2022-08-20T01:10:37.313Z","dependency_job_id":null,"html_url":"https://github.com/tjx666/leetcode-javascript","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/tjx666%2Fleetcode-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjx666%2Fleetcode-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjx666%2Fleetcode-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjx666%2Fleetcode-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tjx666","download_url":"https://codeload.github.com/tjx666/leetcode-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242884322,"owners_count":20201108,"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":["javascript","leetcode"],"created_at":"2024-10-03T16:15:53.532Z","updated_at":"2025-03-10T16:31:36.663Z","avatar_url":"https://github.com/tjx666.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://img.shields.io/travis/tjx666/leetcode-javascript/master?logo=Travis-CI)](https://travis-ci.org/tjx666/leetcode-javascript) [![codecov](https://codecov.io/gh/tjx666/leetcode-javascript/branch/master/graph/badge.svg)](https://codecov.io/gh/tjx666/leetcode-javascript) [![LeetCode Progress](https://img.shields.io/badge/LeetCode-310%20%2F%201726-brightgreen?logo=LeetCode)](https://leetcode-cn.com/u/yutengjing/)\n\n使用 JavaScript 刷 LeetCode\n\n## 同类题\n\n### 求和\n\n- 0002-链表求和（高位在右）\n- 0445-链表求和 II（高位在左）\n- 0067-二进制数字符串求和\n- 0415-十进制数字符串求和\n- 0989-数字数组加上一个数\n\n这一类题大都需要要考虑大数导致精度丢失的问题，实际业务中精度丢失更推荐使用 BigInt 来解决，这类题大多可以通过模拟加法计算来解决，需要注意处理进位问题。\n\n### K Sum\n\n- 0001-Two Sum\n- 0167-Two Sum II - 数组已经有序\n- 1099-比 K 小的两数之和\n- 0015-三数之和\n\n对于两数之和，为了达到达到线性复杂度可以考虑使用 map 来保存遍历过程中的信息，在数组已经有序的情况下，可以通过首尾双指针将范围从两头不断缩小。3 数之和可以想办法将其转换为求解两数之和。\n\n### 数字反转\n\n- 0007-反转整数\n- 0190-反转二进制位\n\n这一类题目就想办法从低位到高位取到原数字每一位，每取到一位就将结果先乘以进制值再加上这个位，更简单的做法是转换成字符串再反转。\n\n### 滑动窗口\n\n- 0003-无重复字符的最长子串\n- 0149-至多包含两个不同字符的最长子串\n\n求满足限定条件的连续字符串通常都可以使用快慢双指针模拟一个滑动窗口来解决。\n\n### 回文判断\n\n- 0009-判断回文数\n- 0125-验证回文字符串\n- 0680-验证回文字符串 II（允许删除一个字符）\n- 0234-判断回文链表\n\n回文数的题目其实可以转换为回文字符串的问题，对于字符串或者是字符数组，判断是否回文一般有三种思路：\n\n1. 首尾双指针\n2. 判断反转后的字符串是否和原字符串相同\n3. 比较前半段和后半段\n\n判断回文数如果要求不能转换成字符串，可以想办法拿到前半段表示的数和后半段表示的数，这就要求你会取整数的每一位。\n判断回文链表有个比较巧妙的方法是利用递归遍历链表是反序遍历的特点。\n\n### 罗马数字\n\n1. 0012-整数转罗马字符串\n2. 0013-罗马数字字符串转整数\n\n### 树的序列化和反序列化\n\n1. 0297-二叉树的序列化和反序列化\n2. 0428-N 叉树的序列化和反序列化\n3. 0449-二叉搜索树的序列化和反序列化\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjx666%2Fleetcode-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftjx666%2Fleetcode-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjx666%2Fleetcode-javascript/lists"}