Leetcode - Consecutive Characters
Leetcode - Island Perimeter

Leetcode - Valid Palindrome II

violet posted @ Jul 03, 2020 12:15:18 PM in 算法 with tags Algorithm Golang array , 223 阅读

https://leetcode.com/problems/valid-palindrome-ii/

Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.

Example 1:

Input: "aba"
Output: True

Example 2:

Input: "abca"
Output: True
Explanation: You could delete the character 'c'.

 

func validPalindrome(s string) bool {
    deleted := false
    j := len(s)-1
    result := true
    for i := 0; i <= j; i++ {
        if s[i] != s[j] {
            if deleted {
                result = false
            }
            deleted = true
            j++
        }
        j--
    }
    j = len(s)-1
    deleted = false
    for i := 0; i <= j; i++ {
        if s[i] != s[j] {
            if deleted && !result {
                return false
            }
            deleted = true
            i--
        }
        j--
    }
    return true
}
MAC Filtering 说:
Feb 08, 2023 01:20:05 PM

A safeguard The access control method is known as MAC, in which a MAC address is provided to a network card, which is then used to determine network access, and this MAC address is uniquely allocated to each card, providing complete security against access to blacklists. MAC Filtering To pass the MAC filtering, any allowed user must use a whitelist entry device to enter the network, and setting this up is quite simple if you have minimal understanding of the network adapter and its settings.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter