[Thoughts]
这是个简化版。只要考虑几种可能, 如果s.length == t.length,只要看看不相同的字符是否超过一个即可。如果s.length < t.length,看看在s中插入一个字符是否能解决问题。
[Code]
1: bool isOneEditDistance(string s, string t) {
2: int lena = s.size();
3: int lenb = t.size();
4: if(lenb > lena) return isOneEditDistance(t, s);
5: if(lena - lenb > 1) return false;
6:
7: int diff = 0;
8: for(int i =0, j = 0; i< s.size() && j< t.size() && diff < 2; i++, j++) {
9: if(s[i] != t[j]) {
10: diff++;
11: if(lena != lenb) t.insert(j, 1, s[i]);
12: }
13: }
14:
15: if((lena != lenb) && diff <2) return true;
16: if((lena == lenb) && diff ==1) return true;
17: return false;
18: }
11 comments:
Hello Blog admin I want to share some useful articles here for anyone looking for financial help to get through.
I want to talk about a God Fearing loan lender who lend me $400,000.00 to finance my business when I couldn't get help from my community bank here in Ohio, Mr Pedro was very nice to work with in every aspect of financial assistance so I will advise anyone here looking for a loan to contact Mr Pedro on Email / WhatsApp text.
Pedro Email: pedroloanss@gmail.com
Mr Pedro WhatsApp text: +1 863 231 0632
Leetcode.com is a website where people can post and share computer programming problems. Users can also create problems and make them available for other people to solve. multi platform streaming
I'm so amazed together with you that will make your blog like this to be really great so we truly wanted to have a nice and interesting blogs such as this. best chocolate in riyadh
I like your blog post. Keep on writing this type of great stuff. I'll make sure to follow up on your blog in the future. woon clothing
Nice post having excellent contents.This is exactly what I've been looking for.Thank you very good. I simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . home renovation services dubai
Offering top-quality support, finance assignment help delivers expert guidance, original solutions, and punctual assignment completion, enabling students to achieve success in their university management coursework with confidence and academic excellence.
Web designing agency in my area
Custom website builders near me
Web designing studio near me
UI/UX designers near me
SEO-friendly website designers near me
CMS website designing experts near me
Find a Website Designing Expert Near Me for professional, custom web design services.
Website Design Services Near Me
Local Web Design Experts Near Me
Affordable Website Designers Nearby
Top Web Designers in [Your City]
Best Website Design Near [Your Area]
Professional Web Designers Near Me
Expert Website Design Services Nearby
local Website Designers in [Your City]
Website Design Experts Near [Your Area]
E-commerce Website Expert in Delhi – Launch Your Online Store Today
Top E-commerce Website Developer in Delhi – Sell Smarter, Sell Faster
Delhi’s Best E-commerce Website Expert – From Concept to Conversion
Build Your Dream Online Store with Delhi’s E-commerce Website Pro
Expert E-commerce Website Design in Delhi – Boost Sales with Stunning Stores
Professional E-commerce Web Developer in Delhi – Let’s Build Your Brand Online
Your Go-To E-commerce Website Expert in Delhi – Shopify, WooCommerce & More
Delhi’s Trusted E-commerce Website Specialist – Start Selling Online Today
Launch & Scale Your Store with Delhi’s Top E-commerce Website Expert
High-Performance E-commerce Websites by Experts in Delhi
Landing Page Design in Delhi NCR – Boost Your Conversions Today
Top Landing Page Designers in Delhi NCR – Results-Driven Design
High-Converting Landing Page Design Services in Delhi NCR
Delhi NCR’s Best Landing Page Designers – Grow Your Leads Faster
Professional Landing Page Design in Delhi NCR for Any Business
Create Stunning Landing Pages with Experts in Delhi NCR
Landing Page Design Delhi NCR – Drive More Sales & Signups
Custom Landing Pages That Convert – Expert Design in Delhi NCR
Best Landing Page Design Services in Delhi NCR – Optimized for ROI
Delhi NCR Landing Page Experts – Turn Clicks Into Customers
Which Type of Website Is Best for Your Business in Delhi?
Choosing the Right Website for Your Business in Delhi
What Kind of Website Does a Delhi Business Need?
Business Websites in Delhi: Which Type Fits You Best?
How to Pick the Perfect Website for Your Business in Delhi
The Best Website Types for Growing Businesses in Delhi
Which Website Style Suits Your Delhi-Based Business?
Website Types That Work Best for Delhi Businesses
Finding the Right Website for Your Business in Delhi NCR
Post a Comment