- 博客(31)
- 资源 (4)
- 收藏
- 关注
原创 LeetCode总记录(内附跳转具体题目与题解)
该博客用于记录LeetCode刷题情况,具体包含:刷题日期,题目编号(#),难度,类型,具体题解跳转链接(题解也是自己写的)。目标是一日一题,从2019/5/5开始,希望不放弃,也共勉看到该博客的大家,一起努力,一起进步。Fighting! 日期 编号 难度. 类型 链接 2019/5/5 ...
2019-05-05 19:16:14 1420
原创 LeetCode【#43】Multiply Strings(字符串相乘)
题目链接:点击跳转题目:Given two non-negative integersnum1andnum2represented as strings, return the product ofnum1andnum2, also represented as a string.Example 1:Input: num1 = "2", num2 = "...
2019-05-30 15:07:50 232
原创 LeetCode【#67】Add Binary
题目链接:点击跳转题目:Given two binary strings, return their sum (also a binary string).The input strings are bothnon-emptyand contains only characters1or0.Example 1:Input: a = "11", b = "...
2019-05-30 14:54:06 148
原创 LeetCode【#717】1-bit and 2-bit Characters
题目链接:点击跳转题目:We have two special characters. The first character can be represented by one bit0. The second character can be represented by two bits (10or11).Now given a string represent...
2019-05-30 14:43:18 201
原创 LeetCode第138场周赛(Weekly Contest 138)解题报告
这次是第一次参加周赛,在参加之前看了上一场的周赛题目,发现最多也就Medium 难度。而这次的题目还是算简单的,在比赛时由于中途有事走了,时间内完成两题,后两题是晚上补完的。题目有点绕,比如第一题,一开始我以为是一个求LIS的问题,然后最后发现其实很简单,哈哈哈。第三题的示例有点问题,在写完代码之后运行出错,发现第四个示例出了问题。所以有时候代码还是要根据具体题目来进行微小修改的。...
2019-05-27 12:59:17 602
原创 LeetCode【#66】Plus One
题目链接:点击跳转题目:Given anon-emptyarray of digitsrepresenting a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the ...
2019-05-25 10:22:06 240
原创 LeetCode【#28】Implement strStr()
题目链接:点击跳转题目:ImplementstrStr().Return the index of the first occurrence of needle in haystack, or-1if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "l...
2019-05-24 19:10:19 197
原创 LeetCode【#169】Majority Element
题目链接:点击跳转题目:Given an array of sizen, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋times.You may assume that the array is non-empty and the...
2019-05-24 11:36:41 131
原创 LeetCode【#201】Bitwise AND of Numbers Range
题目链接:点击跳转题目:Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.Example 1:Input: [5,7]Output: 4Example 2:...
2019-05-22 20:11:29 189
原创 LeetCode【#238】Product of Array Except Self
题目链接:点击跳转题目:Given an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Example:Input...
2019-05-22 19:14:49 144
原创 LeetCode【#1010】Pairs of Songs With Total Durations Divisible by 60
题目链接:点击跳转题目:In a list of songs, thei-thsong has a duration oftime[i]seconds.Return the number of pairs of songs for which their totalduration in seconds is divisible by60. Formally...
2019-05-22 17:00:05 430
原创 LeetCode【#344】Reverse String
题目链接:点击跳转题目:Write a function that reverses a string. The input string is given as an array of characterschar[].Do not allocate extra space for another array, you must do this bymodifying...
2019-05-19 21:48:57 224
原创 异或运算实现两个数的交换
一、总体介绍通常的交换两个变量a,b的过程为int temp;temp=aa=b;b=temp;需借助上面的第3个临时变量temp.采用下面的方法,对于给定两个整数a,b,下面的异或运算可以实现a,b的交换,而无需借助第3个临时变量:a = a ^ b;b = a ^ b;a = a ^ b;这个交换两个变量而无需借助第3个临时变量过程,其实现主要...
2019-05-19 21:36:13 4344 3
原创 LeetCode【#70】 Climbing Stairs
题目链接:点击跳转题目:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note:Give...
2019-05-19 21:29:37 192
原创 LeetCode【#14】 Longest Common Prefix
题目链接:点击跳转题目:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string"".Example 1:Input: ["flower","f...
2019-05-19 21:20:59 155
原创 LeetCode【#9】Palindrome Number 【string的使用】
题目链接:点击跳转题目:Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -...
2019-05-19 20:19:08 157
原创 C++的 string 使用
一、介绍用字符数组存放字符串容易发生数组越界的错误,而且往往难以察觉。因此,C++ 标准模板库设计了 string 数据类型,专门用于字符串处理。string 类型的变量就是用来存放字符串的,也叫“string对象”。string 并不是C++的基本数据类型,它是 C++ 标准模板库中的一个“类”。在用 C++ 编程时,要优先考虑用 string 对象来处理字符串,因为其用法比字符...
2019-05-19 19:36:39 261
原创 LeetCode【#7】Reverse Integer
题目链接:点击跳转题目:Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21N...
2019-05-19 11:05:50 236
原创 LeetCode【#136】Single Number 【XOR的使用】
题目链接:点击跳转题目:Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you i...
2019-05-18 11:09:21 166
原创 LeetCode【#20】Valid Parentheses 【用字符数组模拟栈】
题目链接:点击跳转题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed...
2019-05-18 10:46:44 157
原创 LeetCode【#371】Sum of Two Integers 【利用二进制运算实现十进制的加减运算】
题目链接:点击跳转题目:Calculate the sum of two integersaandb, but you arenot allowedto use the operator+and-.Example 1:Input: a = 1, b = 2Output: 3Example 2:Input: a = -2, b = 3Out...
2019-05-17 22:53:38 224
转载 【算法设计与数据结构】为何程序员喜欢将INF设置为0x3f3f3f3f?
在算法竞赛中,我们常常需要用到一个“无穷大”的值,对于我来说,大多数时间我会根据具体问题取一个99999999之类的数(显得很不专业啊!)在网上看别人代码的时候,经常会看到他们把INF设为0x7fffffff,奇怪为什么设一个这么奇怪的十六进制数,一查才知道,因为这是32-bit int的最大值。如果这个无穷大只用于一般的比较(比如求最小值时min变量的初值),那么0x7fffffff确实是一...
2019-05-17 22:35:25 145
原创 LeetCode【#268】Missing Number
题目链接:点击跳转题目:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.Example 1:Input: [3,0,1]Output: 2Example 2:Input:...
2019-05-17 22:02:08 163
原创 字符串的字串和子序列的区别
对于一个字符串而言,比如:pikachu字串是在字符串中,取出一块(连续的),如:pik, ach, kac等子序列指的是从字符串中,顺序取出字符,但是可以不连续:如:pau, kch, icu等...
2019-05-11 11:43:18 5795
原创 LeetCode【#15】3Sum
题目链接:点击跳转题目:Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solu...
2019-05-10 14:56:06 137
原创 LeetCode【#342】Power of Four
题目链接:点击跳转题目:Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example 1:Input: 16Output: trueExample 2:Input: 5Output: falseFollow up: Co...
2019-05-10 13:28:38 144
原创 LeetCode【#575】Distribute Candies
题目链接:点击跳转题目:Given an integer array withevenlength, where different numbers in this array represent differentkindsof candies. Each number means one candy of the corresponding kind. You ne...
2019-05-10 12:57:55 146
原创 LeetCode【#172】Factorial Trailing Zeroes
题目链接:点击跳转题目:Given an integern, return the number of trailing zeroes inn!.Example 1:Input: 3Output: 0Explanation:3! = 6, no trailing zero.Example 2:Input: 5Output: 1Explanati...
2019-05-07 13:20:05 144
原创 LeetCode【#349】Intersection of Two Arrays
题目链接:点击跳转题目:Given two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2]Example 2:Input: nums1 = [4,9,5], nums2 =...
2019-05-07 12:48:59 132
原创 C++的vector用法
一、介绍&ensp向量 vector 是一种对象实体, 能够容纳许多其他类型相同的元素, 因此又被称为容器。 与string相同, vector 同属于STL(Standard Template Library, 标准模板库)中的一种自定义的数据类型, 可以广义上认为是数组的增强版。在使用它时, 需要包含头文件 vector, #includevector 容器与数组相比其优点在于它...
2019-05-07 11:18:25 264
原创 LeetCode【#392】Is Subsequence
题目链接:点击跳转题目分析:给我们s,t俩个字符串,问是否可以通过删除t的一些字符得到s,其实换个方法就是说,s是否是t的子串,也就是说s是否是t的一个子集。解题思路:思路一:采用暴力法求解,求出t的所有子集,求子集的过程中,与s进行比较,如果碰到有相等的,那么就返回true,如果子集都枚举完了,还没有找到与s相等的字串,就说明s不是t的字串返回false.但是用这种方...
2019-05-05 20:00:20 237
John数字通信第五版 英文原版PDF,附带书签
2018-12-08
LaTeX入门 刘海洋 清晰带书签
2018-12-08
Mathematical Foundations of Computer Networking 英文原版
2018-10-14
从 0 开始学习 GitHub 系列.pdf
2018-10-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人