Leetcode 记录(1~100)】的更多相关文章

LeetCode面试常见100题( TOP 100 Liked Questions) 置顶 2018年07月16日 11:25:22 lanyu_01 阅读数 9704更多 分类专栏: 面试编程题真题合集 常见算法问题 LeetCode试题 LeetCode常见试题   版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/lanyu_01/article/details/81062232 这篇…
5.回文串 几种方法: 暴力:枚举每一个字串,判断是否为回文串,复杂度O(n^3),暴力月莫不可取 dp:区间dp思想,O(n^2) 中心扩展:找每一个字符,然后往两边扩展,O(n^2) manacher算法:主要是中心扩展的一个优化,链接,这篇讲的易懂 6.ZigZag Conversion P A H N A P L S I I G Y I R 之前用了数学方法,累死了,直接搞个每行的string存一下就行 11. Container With Most Water Start by eva…
Now, I want to just use English to explain the problem, it's about two month before the interview, so I have to practice my oral English more. And I will write my explainations in my code in order to keep this passage looking comfortable. 101. Symmet…
100. Same Tree /** * Definition for a binary tree node. * function TreeNode(val) { * this.val = val; * this.left = this.right = null; * } */ /** * @param {TreeNode} p * @param {TreeNode} q * @return {boolean} */ var isSameTree = function(p, q) { if(p…
100. Same Tree Total Accepted: 100129 Total Submissions: 236623 Difficulty: Easy Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have t…
1.编写hello world脚本 #!/bin/bash # 编写hello world脚本 echo "Hello World!" 2.通过位置变量创建 Linux 系统账户及密码 #!/bin/bash # 通过位置变量创建 Linux 系统账户及密码 #$1 是执行脚本的第一个参数,$2 是执行脚本的第二个参数 useradd "$1" echo "$2" | passwd ‐‐stdin "$1" 3.备份日志 #!…
1.Two Sum naive 4.Median of Two Sorted Arrays 找两个已排序数组的中位数 直接数可以过,但很蠢,O(m+n)时间 class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { ,p2=-; ; int len1 = nums1.size(),len2 = nums2.size(); &…
实习面试前再完成100题,争取能匀速解释清楚题 204. Count Primes 素数筛 class Solution { public: int countPrimes(int n) { ) ; n=n-; vector<,); ;i<=n;i++) { ]]=i; ;j<=prime[]&&prime[j]<=n/i;j++) { prime[prime[j]*i]=; ) break; } } ]; } };  207 210 无向图判断环 topo排序 c…
罗马数字包含以下七种字符: I, V, X, L,C,D 和 M. 字符 数值 I 1 V 5 X 10 L 50 C 100 D 500 M 1000 例如, 罗马数字 2 写做 II ,即为两个并列的 1.12 写做 XII ,即为 X + II . 27 写做  XXVII, 即为 XX + V + II . 通常情况下,罗马数字中小的数字在大的数字的右边.但也存在特例,例如 4 不写做 IIII,而是 IV.数字 1 在数字 5 的左边,所表示的数等于大数 5 减小数 1 得到的数值 4…
能力有限,这道题采用的就是暴力方法,也只超过了39%的用户.需要注意的就是罗马数字如果IXC的后一位比前一位大的采取的是减的方式. Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 给定一个罗马数字,将其转换为整数. 输入保证在1到3999之间. class Solution { public int romanToInt(Stri…