leetcode解题记录

目录

 

 

目录

数组

动态规划

字符串


 


数组

1.leetcode 48 旋转图像

https://leetcode-cn.com/problems/rotate-image/solution/li-kou-48xiao-bai-du-neng-kan-dong-de-fang-fa-zhu-/

https://leetcode-cn.com/problems/rotate-image/solution/xuan-zhuan-tu-xiang-by-leetcode/

 

2.leetcode 54 螺旋矩阵

官方解释:https://leetcode-cn.com/problems/spiral-matrix/solution/luo-xuan-ju-zhen-by-leetcode-solution/

 

3.leetcode 63 不同路径II

动态规划(滚动数组思想):https://leetcode-cn.com/problems/unique-paths-ii/solution/bu-tong-lu-jing-ii-by-leetcode-solution-2/

 

4.leetcode 73 矩阵置零

多种解法:https://leetcode-cn.com/problems/set-matrix-zeroes/solution/ju-zhen-zhi-ling-by-leetcode/

 

5.leetcode 74 搜索二维矩阵

较为巧妙的两种解法:https://leetcode-cn.com/problems/search-a-2d-matrix/solution/sou-suo-er-wei-ju-zhen-by-leetcode/

https://leetcode-cn.com/problems/search-a-2d-matrix/solution/zi-jie-ti-ku-74-zhong-deng-sou-suo-er-wei-ju-zhen-/

 

6.leetcode 75 颜色分类

较为巧妙的解法,一共三种:https://leetcode-cn.com/problems/sort-colors/solution/yan-se-fen-lei-by-leetcode-solution/

 

动态规划

7.leetcode 5 最大回文子串

较为巧妙的三种解法,面试会问到:https://leetcode-cn.com/problems/longest-palindromic-substring/solution/zui-chang-hui-wen-zi-chuan-by-leetcode-solution/

很详细的解释,但是还没看完:https://leetcode-cn.com/problems/longest-palindromic-substring/solution/zhong-xin-kuo-san-dong-tai-gui-hua-by-liweiwei1419/

 

字符串

8.字符串转换函数(atoi)

有限状态机解法:https://leetcode-cn.com/problems/string-to-integer-atoi/

28. 实现 strStr()

字符串匹配问题:kmp、sunday、bm、Horspool算法

43.字符串相乘:

https://leetcode-cn.com/problems/multiply-strings/solution/zi-fu-chuan-xiang-cheng-by-leetcode-solution/

https://leetcode-cn.com/problems/multiply-strings/solution/you-hua-ban-shu-shi-da-bai-994-by-breezean/

76.最小覆盖字符串:

https://leetcode-cn.com/problems/minimum-window-substring/solution/c-unordered_map-8ms-9847-by-karlzhang/

 

剑指offer系列:

offer13 机器人的运动范围:

https://leetcode-cn.com/problems/ji-qi-ren-de-yun-dong-fan-wei-lcof/solution/mian-shi-ti-13-ji-qi-ren-de-yun-dong-fan-wei-dfs-b/

offer62 圆圈中剩下的最后数字

https://leetcode-cn.com/problems/yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof/solution/yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-by-lee/

offer55 平衡二叉树

https://leetcode-cn.com/problems/ping-heng-er-cha-shu-lcof/solution/mian-shi-ti-55-ii-ping-heng-er-cha-shu-cong-di-zhi/

 

DFS模板

dfs(){

    // 第一步,检查下标是否满足条件

    // 第二步:检查是否被访问过,或者是否满足当前匹配条件

    // 第三步:检查是否满足返回结果条件

    // 第四步:都没有返回,说明应该进行下一步递归
    // 标记
    dfs(下一次)
    // 回溯
}  


main() {
    for (对所有可能情况) {
        dfs()
    }
}

 

你可能感兴趣的:(leetcode,leetcode)