算法
收一伞烟雨_
这个作者很懒,什么都没留下…
展开
-
算法:配对游戏(美团)
美团点评是综合性生活服务平台,覆盖吃喝玩乐。在休闲娱乐版块,有很多轰趴、桌游、密室逃脱类的项目,适合多人一起玩。下面就是出自团队游戏场景中的一个问题。有 n 个人排成一排,一开始全部面向前方,然后大家一起转身,随机朝左或是朝右转。 转身后,不断检查队列,如果存在两个面对面的相邻的人,则将这两个人从队列中消除;直到不存在两个面对面的相邻的人。 例如 > 表示向右, < 表示向左 ...原创 2018-03-22 21:13:10 · 989 阅读 · 0 评论 -
【LeetCode】3. Longest Substring Without Repeating Characters(求最长的无重复子串)
Given a string, find the length of the longest substring without repeating characters.这是求最长的无重复子串Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. E...原创 2018-09-28 22:04:53 · 142 阅读 · 0 评论 -
【leetcode】Add Two Numbers
You are given two non-empty linked lists representing twonon-negative integers. The digits are stored in reverse order andeach of their nodes contain a single digit. Add the two numbers andreturn...原创 2018-09-28 21:52:59 · 159 阅读 · 0 评论 -
【leetcode】12. Integer to Roman and 13. Roman to Integer 整数与罗马数字互转(中等难度)
地址:https://leetcode.com/problems/integer-to-roman/description/思维:整数转化为罗马数字在这里输入是数字,所以不用担心输入的问题,但是每个结果里面有好几种可能。可以分为四类,100到300一类,400一类,500到800一类,900最后一类。每一位上的情况都是类似的分完情况,用数组表示罗马数字和数字的对应,依次遍历循环。...原创 2018-10-07 15:51:59 · 235 阅读 · 0 评论 -
【leetcode】11. Container With Most Water最大水容器(中等难度)
题目:Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find ...原创 2018-10-07 13:20:34 · 256 阅读 · 0 评论 -
【spring boot】服务器启动成功后,过一段时间会关闭
启动命令:java -jar yuedaoapi-1.0.0.jar > log.txt 2>&1 &其中 >log.txt 是把输出日志存放到文件中2>&1 输出所有的日志文件& 后台启动但是每次启动会,每隔几分钟或者几个小时,应用会自动停止,错误如下:Closing org.springframework.boot.web...原创 2018-10-06 19:13:20 · 2129 阅读 · 0 评论 -
【leetcode】10. Regular Expression Matching正则表达式匹配
地址:https://leetcode.com/problems/regular-expression-matching/description/思维:若p为空,若s也为空,返回true,反之返回false若p的长度为1,若s的长度也为1,且相同或者p为’.’,那么返回true,否则返回false;若p的第二格字符不为*,且s是空的,那返回false,如果s不为空,且第一个字符相同,...原创 2018-10-06 14:49:17 · 197 阅读 · 0 评论 -
【leetcode】8. String to Integer (atoi)(从string中按照规则提取int)
Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from thi...原创 2018-10-06 12:55:29 · 139 阅读 · 0 评论 -
【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: 21Note:Assume we are dealing ...原创 2018-10-01 22:15:35 · 202 阅读 · 0 评论 -
【leecode】 6.ZigZag Conversion(锯齿形变换)
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S ...原创 2018-10-01 13:12:08 · 417 阅读 · 0 评论 -
360公司 2018校招 技术综合C卷在线考试 编程题
注意:如有侵权,请告知,我立马删除。编程题 | 20.0分1/3 画板 时间限制:C/C++语言 1000MS;其他语言 3000MS 内存限制:C/C++语言 65536KB;其他语言 589824KB 题目描述: 沫璃有一个画板,画板可以抽象成有100行每行100个像素点的正方形。沫璃在画板上画画,她一共画了n次, 每次将一个矩形涂上颜色。沫璃想知道一共有多少个原创 2018-04-01 16:08:46 · 1752 阅读 · 0 评论 -
算法:构造回文(腾讯2017暑期实习生)
题目:给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢? 输出需要删除的字符个数。输入描述: 输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.:输出描述: 对于每组数据,输出一个整数,代表最少需要删除的字符个数。实例 输入: abcda google ...原创 2018-03-21 21:49:11 · 234 阅读 · 0 评论 -
【leetcode】5. Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s.You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Exam...原创 2018-09-29 22:50:28 · 123 阅读 · 0 评论