07 2023 档案

摘要:总结一下leetcode中遇见的2-sum, 3-sum, 4-sum问题,并扩展到n-sum。 1. 两数之和 - 力扣(LeetCode) 梦开始的地方,不多说。 class Solution { public int[] twoSum(int[] nums, int target) { Map 阅读全文
posted @ 2023-07-31 21:45 Vege_dog 阅读(46) 评论(0) 推荐(0) 编辑
摘要:总结一下leetcode中遇见的异位词问题: 242. 有效的字母异位词 - 力扣(LeetCode) 本题是异位词题目中最基础的,有两种方法可以轻松解决: 1. 排序法,时间复杂度O(n log n): class Solution { //排序解决 public boolean isAnagra 阅读全文
posted @ 2023-07-31 00:45 Vege_dog 阅读(16) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示