
oj字符串操作
mysterious_i
这个作者很懒,什么都没留下…
展开
-
给定一个子串,寻找没有重复字符的最长子串
/*Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", w原创 2017-10-12 08:57:16 · 996 阅读 · 0 评论 -
Leetcode 5: Longest Palindromic Substring
//最长回文,可以将字符串从中间拆开,按左右两部分,一个向左移一个向右移进行对称匹配,每次移动都以移动到的点为哨兵位置,进行对称匹配class Solution {public: string longestPalindrome(string s) { int solder = s.length() / 2; string longest_str = ""; longest_s...原创 2018-03-26 16:50:02 · 119 阅读 · 0 评论