palindrome

package
v0.0.0-...-cc2c25f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

README

检查一个字符串是否是回文

描述

  • 回文,就是颠倒之后,和原始字符串是一样的

问题

  • 输入一个字符串,判断是否是回文

解决过程

  • 使用遍历的方式进行对比
  • 使用库(标准库并未提供,使用其他方式实现)
    • 使用遍历
    • 遍历一半,发现首尾不一致就返回
  • 进行基准测试
    • 遍历会申请多次内存,遍历一半的方法比第一种方法的效率高10倍

未优化

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPalindrome

func CheckPalindrome(testString string) bool

CheckPalindrome check a is palindrome or not

func CheckPalindrome2

func CheckPalindrome2(testString string) bool

CheckPalindrome2 is another impl

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL