GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LeetCode/Dynamic_Programming/1216.Valid-Palindrome-III at master · wisdompeak/LeetCode

Expand file tree

/

1216.Valid-Palindrome-III

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

1216.Valid-Palindrome-III

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
1216.Valid-Palindrome-III.cpp
1216.Valid-Palindrome-III.cpp
 
 
Readme.md
Readme.md
 
 

Readme.md

1216.Valid-Palindrome-III

此题和1312题很相似的想法。想要将一个字符串s变成一个回文串(无论是通过增加还是删除),一个技巧就是构造另一个字符串t是s的逆序。于是,如果要求增加字符,那么s和t的shorted common supersequence就是需要增加的最少字符;如果要求删除字符,那么s和t的longest common subsequence就对应着需要删除的最少字符。

本题求出s和t的LCS后,只需要判断s的长度减去LCS的长度(即对于s而言最少需要删除的字符)是否小于等于k即可。

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.