首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
验证回文字符串(二)
[编程题]验证回文字符串(二)
热度指数:1848
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
给定一个字符串,请问
最多
删除一个的情况下,能否组成一个回文字符串。
回文字符串:正着读和反着读是一样的字符串。
数据范围:字符串长度满足
,字符串中仅包含小写英文字母
示例1
输入
"nowwon"
输出
true
示例2
输入
"nowewon"
输出
true
示例3
输入
"noweawon"
输出
true
示例4
输入
"noowwwn"
输出
false
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
查看答案及解析
添加笔记
求解答(0)
邀请回答
收藏(24)
分享
纠错
提交结果有问题?
0个回答
13篇题解
添加回答
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
贪心
字符串
双指针
难度:
0条回答
24收藏
5160浏览
热门推荐
通过挑战的用户
查看代码
牛客31742...
2022-09-15 11:27:33
commoand
2022-09-13 20:28:49
FM_NowC...
2022-09-05 08:15:06
黎童鞋
2022-09-03 21:36:35
牛客11870...
2022-09-01 20:59:39
相关试题
神奇的数字
排序
双指针
评论
(46)
下面使用贪心算法的是?
阿里巴巴
贪心
评论
(1)
和为S的两个数字
数组
数学
双指针
评论
(1512)
来自
“一战通offer”互联...
4.该校1997年男女教师的比例为...
资料分析
言语理解与表达
资料分析
评论
(1)
计算机在工作过程中,若突然停电,(...
计算机常识
普及
C++
Pascal
选择题
评论
(1)
来自
NOIP2008初赛普及组
验证回文字符串(二)
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ public boolean palindrome (String str) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ bool palindrome(string str) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param str string字符串 # @return bool布尔型 # class Solution: def palindrome(self , str ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ public bool palindrome (string str) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ function palindrome( str ) { // write code here } module.exports = { palindrome : palindrome };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param str string字符串 # @return bool布尔型 # class Solution: def palindrome(self , str: str) -> bool: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ func palindrome( str string ) bool { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ bool palindrome(char* str ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param str string字符串 # @return bool布尔型 # class Solution def palindrome(str) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ def palindrome(str: String): Boolean = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ fun palindrome(str: String): Boolean { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ public boolean palindrome (String str) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ export function palindrome(str: string): boolean { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ func palindrome ( _ str: String) -> Bool { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 * @return bool布尔型 */ pub fn palindrome(&self, str: String) -> bool { // write code here } }
"nowwon"
true
"nowewon"
true
"noweawon"
true
"noowwwn"
false