
leetcode
文章平均质量分 93
chad_lee
看论文的
展开
-
【C++机试算法笔记】
整理资料发现了当初准备保研机试记录的算法笔记,大概内容是把一本书的所有算法做完了。当时用的还是C++,现在不用了,不分享出来的话可能这个文件永远都不会被打开了。机试算法笔记笔记C++基础字符常量是单个使用单引号标记的字符;字符串常量则是由双引号标记的字符集。字符串常量可以作为初值赋给字符数组,并使用%s的格式输出。(不能把字符串常量赋值给字符变量)**条件判断是 == **字符所表示的数字的值 = 该字符与字符‘0’的ASCII的值的差( a - ‘0’) 字符一定是单引号!!!原创 2022-02-23 18:47:00 · 1044 阅读 · 0 评论 -
leetcode-9-长按键入
Long pressed nameYour friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times.You examine th...原创 2019-04-06 15:09:22 · 152 阅读 · 0 评论 -
leetcode-8-反转字符串 II
Reverse String IIGiven a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, r...原创 2019-03-15 13:10:04 · 146 阅读 · 0 评论 -
leetcode-1-二叉树的最小深度
leetcode-1-二叉树的最小深度solution1:广度遍历solution2:层次遍历solution3:递归minimum depth of binary treeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path f...原创 2019-02-26 21:01:45 · 328 阅读 · 0 评论 -
leetcode-2-逆波兰表达式求值
evaluate-reverse-polish-notationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examp...原创 2019-03-01 21:19:16 · 171 阅读 · 0 评论 -
leetcode-3-直线上最多的点-鸽了
max points in a lineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.明天写原创 2019-03-01 21:41:45 · 218 阅读 · 0 评论 -
leetcode-4-提莫攻击
Teemo attacking在《英雄联盟》的世界中,有一个叫 “提莫” 的英雄,他的攻击可以让敌方英雄艾希(编者注:寒冰射手)进入中毒状态。现在,给出提莫对艾希的攻击时间序列和提莫攻击的中毒持续时间,你需要输出艾希的中毒状态总时长。你可以认为提莫在给定的时间点进行攻击,并立即使艾希处于中毒状态。eg1输入: [1,4], 2输出: 4原因: 在第 1 秒开始时,提莫开始对艾希进行攻...原创 2019-03-02 14:06:38 · 243 阅读 · 0 评论 -
leetcode-5-二叉树的前序遍历
Binary Tree Preorder TraversalGiven a binary tree,return the preorder traversal of nodes‘ values。follow up:Recursive is trivial(递归也没那么简单吧T T),could u do it iteratively?Input: [1,null,2,3]Output: ...原创 2019-03-03 20:14:14 · 317 阅读 · 0 评论 -
leetcode-6-猜数字大小
Guess my numberWe are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the numbe...原创 2019-03-06 18:17:47 · 189 阅读 · 0 评论 -
leetcode-7-反转字符串中的单词 III
reverse words in a string IIIGiven a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: “L...原创 2019-03-10 21:12:09 · 214 阅读 · 0 评论